<html>
<script type="text/javascript">function haha()
{
var y0=getElementById("TextBox1").value;
var m0=getElementById("TextBox2").value;
var d0=getElementById("TextBox3").value; if(y0==1)
{
if(m0==1)
{ m0=12;
d0=31;
}
else
{
y0=y0+1;
switch(m0)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
d0=31
case 4:
case 6:
case 9:
case 11:
d0=30
case 2:
if((y0%4==0&&y0%100!=0)||y0%400==0)//闰年
d0=29
else
d0=28
}
m0=m0-1;
}
}
alert(y0+","+m0+","+d0);
} </script><head>
<title>gfgfff</title>
</head>
<body>
<input type="text" id="TextBox1"><br />
<input type="text" id="TextBox2"><br />
<input type="text" id="TextBox3"><br />
<input type="button" onclick="haha()" value="调用函数">
</body>
</html>单击按钮。出错。提示:
行:6
字符:3
缺少对象。
大家帮忙看下哪里的问题?
<script type="text/javascript">function haha()
{
var y0=getElementById("TextBox1").value;
var m0=getElementById("TextBox2").value;
var d0=getElementById("TextBox3").value; if(y0==1)
{
if(m0==1)
{ m0=12;
d0=31;
}
else
{
y0=y0+1;
switch(m0)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
d0=31
case 4:
case 6:
case 9:
case 11:
d0=30
case 2:
if((y0%4==0&&y0%100!=0)||y0%400==0)//闰年
d0=29
else
d0=28
}
m0=m0-1;
}
}
alert(y0+","+m0+","+d0);
} </script><head>
<title>gfgfff</title>
</head>
<body>
<input type="text" id="TextBox1"><br />
<input type="text" id="TextBox2"><br />
<input type="text" id="TextBox3"><br />
<input type="button" onclick="haha()" value="调用函数">
</body>
</html>单击按钮。出错。提示:
行:6
字符:3
缺少对象。
大家帮忙看下哪里的问题?
在VS里编辑JS好像没有像编辑C#那样的智能提示。有没有其他好用点的编辑器?