开发者

Delimiter causing w3c validation error

I want my home clear of all W3C errors. I have开发者_JAVA技巧 one final error:

http://validator.w3.org/check?uri=http://storeboard.com

Here is the code for that error:

 if (ErrorFound == 0)
 {
      if (document.frmRegister.tbPassword.value.length < 8)
      {
           alert("Password must be at least 8 characters in length.");
           document.frmRegister.tbPassword.focus();
           ErrorFound = ErrorFound + 1
      }
 }

Any ideas how I can keep the same functionality but prevent the W3C Error?

Many Thanks,

Paul


You can put your script in a CDATA block, which will cause it to be ignored by the XML parser:

<script type="text/javascript">
    //<![CDATA[
    ...
    //]]>
</script>


This is described in the HTML Compatibility Guidelines for XHTML.


Or you could use > instead of <, which triggered the validation error

if (ErrorFound == 0)
 {
      if (8>document.frmRegister.tbPassword.value.length)
      {
           alert("Password must be at least 8 characters in length.");
           document.frmRegister.tbPassword.focus();
           ErrorFound = ErrorFound + 1
      }
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜