Monday, February 11, 2013

jsp to display todays day of the week


<!--fms-->
<html>
<body>

<p id="demo">Click the button to display todays day of the week.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
var d = new Date();
var weekday=new Array(7);
weekday[0]="Today is Sunday";
weekday[1]="Today is Monday";
weekday[2]="Today is Tuesday";
weekday[3]="Today is Wednesday";
weekday[4]="Today is Thursday";
weekday[5]="Today is Friday";
weekday[6]="Today is Saturday";

var x = document.getElementById("demo");
x.innerHTML=weekday[d.getDay()];
}
</script>

</body>
</html>

No comments:

Post a Comment