PDA

View Full Version : validator behaviour


Madge
December 11th, 2002, 09:05 PM
I have just validated my first two pages (ever) against XHTML 1.0 Transitional (fanfare! fireworks!).

After correcting two zillion nonconformances I am left with the same single error on each.

"onClick is not a valid attribute of the this element."
The immediate container is the a (anchor) element. This is then contained within td within tr within table within body. (I use onClick to summon up a popup window).

On rechecking the W3C specification this clearly allows onClick to be contained within any of the above elements and does not disallow any of them (crosschecking in the other direction against where onClick can be contained), so I am puzzled.

The other funny thing is that it only lists the first occurrence. Where I missed the closing tag out of my img elements it patiently listed each and every occurrence, and the same for missing alt tags, but in this case it prohibits my first usage and ignores subsequent identical usages. Is this typical validator behaviour?

I tested against the W3C validator and also Liam Quinn's WDG Validator with identical results. (Are they based on the same engine? is there any point in trying both?)

Any clues?

p.s. One page was validated against Transitional and the other against Frameset.

My code was in this format on both pages:

<td><a href="explorer.htm" onClick="openPopup()" target="smallpopup"><img src="images\msie.gif" alt="MSIE icon" height="32" width="32" border="0" /></a></td>

and the error warning was:

Error: there is no attribute onClick for this element (in this HTML version)

Steven.Bentley
December 11th, 2002, 09:37 PM
try making it onclick - note the lower case c - all XHTML elements and attributes have to be lower case :)

Madge
December 11th, 2002, 10:45 PM
Steven

Spot on!

Once again I was looking for the complicated when the simple solution was under my nose. I hope when I get more used to XHTML lower-case will become force of habit.

Many thanks again

Steven.Bentley
December 12th, 2002, 08:34 PM
no problem :) wouldn't it be nice if the validator told us that that was the reason it rejected the page? ;)

Madge
December 12th, 2002, 11:41 PM
Yes, but if the best things in life are free, the validator is certainly one of them. (OK, this site's another one!)

I find the WDG validator http://www.htmlhelp.com/tools/validator/
particularly easy to use. I don't know if you have a preference or recommendation?

Steven.Bentley
December 13th, 2002, 08:44 PM
I tend to just use http://validator.w3.org but I might try some others :)

degsy
December 14th, 2002, 01:21 PM
I prefer http://validator.w3.org
Just used to it I suppose.