PDA

View Full Version : JavaScript and validation Strict


Muffin_LA
25-11-2005, 14:45/02:45PM
Hi everyone;

I am trying to validate a page using Strict dtd. The problem is that the image tag uses the name attribute which isnt allowed in Strict. But I need the name attribute because of the following:

document.animation.src = horses[curHorse].src;
<p><img src="rockinghorse0.jpg" name="animation" alt="Rocking Horse" /></p>

Is there any way to get around this?

Thanks
Linda

greenpastureslc
26-11-2005, 19:46/07:46PM
Try changing the name attribute to id. Some of the tutorials I've been going through lately say that name was replaced by id.

Hope this helps.

Muffin_LA
26-11-2005, 20:22/08:22PM
Hi greenpastureslc:

I figured it out after much searching. I changed the

document.animation
to
document.images[0]
and deleted the name attribute from the image tag.

It works

Thanks
Linda

greenpastureslc
26-11-2005, 20:46/08:46PM
I'll have to remember that if I ever come accross that situation.