Question

I have this problem of an image rollover javascript not working in Internet Explorer if I don't specify the NAME attribute in the tag. The other problem is when I do, the HTML5 validator will come up with a message saying "NAME attr is obsolete, use ID instead" which is what I am using with getElementById.

Should I specify a NAME attribute anyway and ignore the error messages or is there a workaround? I don't wish to add extra attributes if I don't have too.

Thanks

Adam

Was it helpful?

Solution

You aren't calling getElementById; you're writing document[img_name].
Don't.

OTHER TIPS

Check to make sure you do not have duplicate ids. getElementById incorrectly gets name="" in certain IEs, if there is no element with the id.

Also, make sure the document is not in quirks mode and is in standards mode. alert( document.compatMode ) and make sure it isnt BackCompat. If it is, use a proper doctype and kill comments/whitespace before doctype.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top