add a javascript excercise
This commit is contained in:
parent
a7e5a84f1a
commit
0b7a64ab39
|
@ -0,0 +1,10 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<head>
|
||||||
|
<script type="text/javascript" src="return_month.js"></script>
|
||||||
|
<title>JavaScript</title>
|
||||||
|
</head>
|
||||||
|
<body onload="returnMonth();">
|
||||||
|
<h1>JavaScript</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,8 @@
|
||||||
|
function returnMonth() {
|
||||||
|
var monthNames = ["January", "February", "March", "April", "May", "June",
|
||||||
|
"July", "August", "September", "October", "November",
|
||||||
|
"December"]
|
||||||
|
var currentDate = new Date();
|
||||||
|
var m = monthNames[currentDate.getMonth()];
|
||||||
|
alert(m);
|
||||||
|
}
|
Reference in New Issue