JavaScript Forum JS Made Easy: Free JavaScripts Tutorials Example Code
About This Product
FontsMadeEasy.com
 
The Business Internet
Find it on This page:
 
| Over 5000 Free Fonts | Tutorials | Javascript Forum | Other Javascript Resources | Cheat Sheet

     
Jsmadeeasy Forums Home   Search   Login   Register   Member List  
JS Made Easy  > JavaScript programming  > Validating a page containing JS with W3C  
 
Display using:  
Previous Thread :: Next Thread 
 Author Thread: Validating a page containing JS with W3C
rtownship is not online. Last active: 2/11/2006 4:22:05 PM rtownship
Top 100 Poster
Joined: 11 Feb 2006
Total Posts: 2
 
Validating a page containing JS with W3C
Posted: 11 Feb 2006 01:07 PM
Can anyone tell me why this does not validate as strict html?
It validates as html 4 with no problem and the page works, but not after changing the DTD.
The line that the validator doesn't like is the if(hr<12). How else can you say "less than" in JS?

"Warning Line 41 column 5: character "<" is the first character of a delimiter but occurred as data if(hr<12)"


<script type="text/javascript">
var mnames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
rightnow = new Date();
mo = rightnow.getMonth();
dt = rightnow.getDate();
yr = rightnow.getYear();
hr = rightnow.getHours();
mn = rightnow.getMinutes();
document.write(mnames[mo])
document.write( " " + dt + ", " + yr + ", " + hr +":" + mn );
if(hr<12)
{
document.write("am")
}
else
{
document.write("pm")
}
</script>
Previous Thread :: Next Thread 
Page 1 of 1
 
Jsmadeeasy.com  > JS Made Easy  > JavaScript programming  > Validating a page containing JS with W3C