Monday, 27 February 2012

Using switch statement

<html>
<body>
<script type="text/javascript">
var d=new Date();
var theDay=d.getDay();
switch (theDay)
{
case 5:
  document.write("<b>Saturday</b>");
  break;
case 6:
  document.write("<b>monday</b>");
  break;
case 0:
  document.write("<b>tuesday</b>");
  break;
default:
  document.write("<b>sunday</b>");
}
</script>
</body>
</html>



 

No comments:

Post a Comment