View Full Version : xhtml strict validate about i--
guoshuang
11-16-2005, 08:37 AM
if use i-- in javascript,the W3C validater will report error.how to fix it?
<script type="text/javascript">
<!--
for(i=10;i>0;i--){
...
}
-->
</script>
i=i-1 ? :(
_Aerospace_Eng_
11-16-2005, 04:31 PM
In XHTML Strict you need to have a certain style of comments. Try this
<script type="text/javascript">
//<![CDATA[
for(i=10;i>0;i--){
...
}
//]]>
</script>
Bill Posters
11-16-2005, 04:52 PM
Alternatively, keep your js in an external js file and bring it in as a resource in the head…
e.g.
<script type="text/javascript" src="sitescripts.js"></script>
When using external js, you don't need to use comments to have the validator ignore the js.
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.