Javascript setAttribute() in IE6

Not all cases of the setAttribute() function work in IE6. Take the case of a sample code below

link = document.createElement('a');
link.innerText = 'remove';
link.textContent = 'remove';
link.href = 'javascript://';
link.setAttribute('onclick', 'myfunc()');

When you click on the link element labeled ‘removed’, it will not work. Later versions of IE do work as well as Mozilla browsers. If you did this kind of code, it would be better for you to write the whole element tag in a span or div’s innerHTML.

Related Posts Plugin for WordPress, Blogger...
  1. 2 Responses to “Javascript setAttribute() in IE6”

  2. one time i am going to ask you something about programming. will you be able to spend time to answer my questions
    Ester’s Money Journal
    Ester’s Recollections

    By my daily thoughts on Oct 1, 2008

  3. anytime ;)

    By tech on Oct 1, 2008

Post a Comment

Anti-Spam Protection by WP-SpamFree

Spam protection by WP Captcha-Free