JavaScript causes errors in XHTML validation

Soldato
Joined
2 Nov 2002
Posts
3,304
Location
Aberdeen
I know this happens, and i know why etc, but is there any way i can stop this happening?

for example, i have links that when rolled over, change.

Code:
image1 = new Image();
image1.src = "link1.gif";

...

...

Code:
<a href="www.home.com" onmouseover="image1.src='link1.gif';" onmouseout="image1.src='link1n.gif';">
<img name="image1" src="link1n.gif" alt="hi"></a>

I've managed to put the first part into CSS, but i'm still greeted with the error

"there is no attribute "name"."

Is there another calling for "name"?
 
Last edited:
Taking away the "name="image1" and replacing it with id="image1" seems to do the trick...

Thanks anyways, err i guess.
 
Thanks for the link.

Could you also tell me whether or not i should code it in xhtml 1.1 or xhtml 2.0? Does it really matter?, a little brief question here i know, but i was wondering.

I tried in xhtml 2.0 but i couldn't get the conformance definition set up correctly so i gave up lol.
 
XHTML 1.0 Strict, if you want to use XHTML. Otherwise HTML 4.01 Strict. Either way, go for a strict doctype and worry less about the exact standard you're aiming for.

XHTML 1.1/2.0 isn't currently supported by IE as they require the mimetype application/xhtml+xml, which it doesn't recognise. So there's little point using them if you want widespread support and wish to conform to the standards. XHTML 1.0 should also be sent with that mimetype, but it's acceptable to send it as HTML (text/html) instead of XML.

XHTML2 isn't actually a formal recommendation yet (still a working draft), so best not try and use it anyway.
 
Last edited:
Ah ok thank you, i was wondering why it was coming up with all those errors, even though i done exactly as stated on the site.
 
Back
Top Bottom