hi everyone,
can anybody tell me why the “var” is on the first line and not the second line ?
var d = new Date()
theDay=d.getDay()
and what is the significance of the “new” reserved word here ?
this is the original script:
<html>
<body>
<script type=”text/javascript”>
var d = new Date()
theDay=d.getDay()
switch (theDay)
{
case 5:
document.write(“<b>Finally Friday</b>”)
break
case 6:
document.write(“<b>Super Saturday</b>”)
break
case 0:
document.write(“<b>Sleepy Sunday</b>”)
break
default:
document.write(“<b>I’m really looking forward to this weekend!</b>”)
}
</script>
<p>This JavaScript will generate a different greeting based on what day it is. Note that Sunday=0, Monday=1, Tuesday=2, etc.</p>
</body>
</html>