faqts : Computers : Programming : Languages : JavaScript : Links

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 10 people (50%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

how can i change the color of an anchor I have disable , to a specific color I choose????

Feb 24th, 2003 00:47
Klaus Bolwin, comma geneus,


There is a way to set the color of disabled links in Mozilla based on a
modification of the code in the following contribution:
http://www.faqts.com/knowledge_base/view.phtml/aid/1894/fid/189
in MSIE, you can change the color, but it is set to a default (gray)
color, when disabeling the link.
Make these changes to the above mentioned code and try it in Mozilla:
function disableLink (link) {
  if (link.onclick)
    link.oldOnClick = link.onclick;
  link.onclick = cancelLink;
  if (link.style)
    link.style.cursor = 'default';
    link.style.color = "red";
}
function enableLink (link) {
  link.onclick = link.oldOnClick ? link.oldOnClick : null;
  if (link.style)
    link.style.cursor =
      document.all ? 'hand' : 'pointer';
      link.style.color = "blue";
}