简体   繁体   English

引起W3C验证错误的定界符

[英]Delimiter causing w3c validation error

I want my home clear of all W3C errors. 我希望我的家清除所有W3C错误。 I have one final error: 我有一个最后的错误:

http://validator.w3.org/check?uri=http://storeboard.com 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? 有什么想法可以保持相同的功能但又可以防止W3C错误?

Many Thanks, 非常感谢,

Paul 保罗

You can put your script in a CDATA block, which will cause it to be ignored by the XML parser: 您可以将脚本放在CDATA块中,这将导致XML解析器将其忽略:

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

XHTMLHTML兼容性指南中对此进行了描述。

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
      }
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM