[thelist] Javascript/XHTML Strict Validation
Kevin Switzer
Kevin.Switzer at Stamats.com
Mon Nov 8 13:26:36 CST 2004
Hello all,
I have a page that is XHTML Strict. I get 4 errors, but I'm not sure
how to fix them, have the javascript still work, and validate in XHTML
Strict. Any help would be MUCH appreciated.
I am getting the following errors:
Below are the results of attempting to parse this document with an SGML
parser.
1. Line 16, column 30: character ";" not allowed in attribute
specification list
for (var i=0; i<sfEls.length; i++) {
2. Line 16, column 30: element "sfEls.length" undefined
for (var i=0; i<sfEls.length; i++) {
You have used the element named above in your document, but the document
type you are using does not define an element of that name. This error
is often caused by incorrect use of the "Strict" document type with a
document that uses frames (e.g. you must use the "Frameset" document
type to get the "<frameset>" element), or by using vendor proprietary
extensions such as "<spacer>" or "<marquee>" (this is usually fixed by
using CSS to achieve the desired effect instead).
3. Line 26, column 8: end tag for "sfEls.length" omitted, but
OMITTAG NO was specified
</script>
You may have neglected to close a tag, or perhaps you meant to
"self-close" a tag; that is, ending it with "/>" instead of ">".
4. Line 16, column 17: start tag was here
for (var i=0; i<sfEls.length; i++) {
This is the javascript code (which is being used with Suckerfish Menus):
<script type="text/javascript">
sfHover = function() {
var sfEls =
document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+="
sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload",
sfHover);
</script>
Thank you all in advance!!
More information about the thelist
mailing list