只想知道怎么修改这段JavaScript代码,不求分析,只求给出正确答案
<html><head><title>unnamed</title><scripttype="text/javascript">varmyDate=newDate();m...
<html>
<head>
<title>unnamed</title>
<script type="text/javascript">
var myDate=new Date();
myDate.setFullYear(getElementById("id1").value);
myDate.setMonth(getElementById("id2").value);
myDate.setDate(getElementById("id3").value);
var weekindex=myDate.getDay();
var ease1="It is ";var ease2=" on your birthday";
function _cligck()
{
switch(weekindex)
{
case 0:
alert(ease1+"Monday"+ease2);
break;
case 1:
alert(ease1+"Tuesday"+ease2);
break;
case 2:
alert(ease1+"Wednesday"+ease2);
break;
case 3:
alert(ease1+"Thursday"+ease2);
break;
case 4:
alert(ease1+"Friday"+ease2);
break;
case 5:
alert(ease1+"Saturday"+ease2);
break;
case 6:
alert(ease1+"Sunday"+ease2);
break;
}
}
</script>
</head>
<body><form>
<table>
<tr>
<td ><input type="text" name="year" id="id1"></td>
<td>年<td>
<td ><input type="text" name="month" id="id2"></td>
<td>月<td>
<td ><input type="text" name="day" id="id3"></td>
<td>日<td>
</tr>
</table>
<input type="button" onclick="_cligck()" value="click to show"></form>
</body>
</html> 展开
<head>
<title>unnamed</title>
<script type="text/javascript">
var myDate=new Date();
myDate.setFullYear(getElementById("id1").value);
myDate.setMonth(getElementById("id2").value);
myDate.setDate(getElementById("id3").value);
var weekindex=myDate.getDay();
var ease1="It is ";var ease2=" on your birthday";
function _cligck()
{
switch(weekindex)
{
case 0:
alert(ease1+"Monday"+ease2);
break;
case 1:
alert(ease1+"Tuesday"+ease2);
break;
case 2:
alert(ease1+"Wednesday"+ease2);
break;
case 3:
alert(ease1+"Thursday"+ease2);
break;
case 4:
alert(ease1+"Friday"+ease2);
break;
case 5:
alert(ease1+"Saturday"+ease2);
break;
case 6:
alert(ease1+"Sunday"+ease2);
break;
}
}
</script>
</head>
<body><form>
<table>
<tr>
<td ><input type="text" name="year" id="id1"></td>
<td>年<td>
<td ><input type="text" name="month" id="id2"></td>
<td>月<td>
<td ><input type="text" name="day" id="id3"></td>
<td>日<td>
</tr>
</table>
<input type="button" onclick="_cligck()" value="click to show"></form>
</body>
</html> 展开
2个回答
展开全部
function _cligck()
{
var myDate=new Date();
myDate.setFullYear(document.getElementById("id1").value);
myDate.setMonth(document.getElementById("id2").value);
myDate.setDate(document.getElementById("id3").value);
var weekindex=myDate.getDay();
var ease1="It is ";var ease2=" on your birthday";
switch(weekindex)
{
case 0:
alert(ease1+"Monday"+ease2);
break;
case 1:
alert(ease1+"Tuesday"+ease2);
break;
case 2:
alert(ease1+"Wednesday"+ease2);
break;
case 3:
alert(ease1+"Thursday"+ease2);
break;
case 4:
alert(ease1+"Friday"+ease2);
break;
case 5:
alert(ease1+"Saturday"+ease2);
break;
case 6:
alert(ease1+"Sunday"+ease2);
break;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询