i was working with some coding but i found my self in trouble when i got that setAttribute is not working. i used in internet explorer 6,7 but not working please anyone can help me to find out what is wrong ?
i was working with some coding but i found my self in trouble when i got that setAttribute is not working. i used in internet explorer 6,7 but not working please anyone can help me to find out what is wrong ?
This is probably because IE considers setAttribute as setting the property of the actual javascript object. By setting the style attribute on a node, IE interprets it as setting node.style, which is not the actual attribute (node.style being an array of the different css settings instead). That's also why you can't set the 'class' or 'for' attributes, because on a element object, the old method of setting class and the for attribute are node.className and node.htmlFor.
When calling the DOM method .setAttribute( attName, attValue ); in IE, there are several circumstances where it will not work.
Setting the "name" attribute does not work, the "colspan" & "rowspan" attributes for th and td tags does not work, the "frameborder" attribute on iframes does not work.
Using the DOM Methods to build up new content for your page, be aware that in IE, you can't pre-check a radio button or a checkbox using .setAttribute('checked', 'checked'); or even myCheckBoxObject.checked = true; *unless* you add the element to the page first.
Bookmarks