没反应!
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>单击事件 </title> <script type="text/javascript"> function wwt() { var tadays = new Date(a,b,c); a = document.getElementById("n1").value; b = document.getElementById("n2").value; c = document.getElementById("n3").value; var weekday= ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]; document.write(weekday[tadays.getDay()]); } </script> </head> <body> <form> <input type="text" id="n1" />年<br /> <input type="text" id="n2" />月<br /> <input type="text" id="n3" />日<br /> <input name="点击我" onClick="wwt()" type="button" value="查询"/> </form> </body> </html>
a = document.getElementById("n1").value; b = document.getElementById("n2").value; c = document.getElementById("n3").value; var tadays = new Date(a,b,c);
交换一下顺序
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>单击事件 </title> <script type="text/javascript"> function wwt() { a = document.getElementById("n1").value; b = document.getElementById("n2").value-1; c = document.getElementById("n3").value; var tadays = new Date(a,b,c); var weekday= ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; document.getElementById("n4").value=weekday[tadays.getDay()]; } </script> </head> <body> <form> <input type="text" id="n1" />年<br /> <input type="text" id="n2" />月<br /> <input type="text" id="n3" />日<br /> <input name="点击我" onClick="wwt()" type="button" value="查询"/><br /> <input type="button" value="星期"> <input type="text" id="n4" /> </form> </body> </html>
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>单击事件 </title> <script type="text/javascript"> function wwt() { var a = document.getElementById("n1").value; var b =document.getElementById("n2").value-1;//参数month的值比实际月份小1 var c = document.getElementById("n3").value; var tadays = new Date(a,b,c); var weekns = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; document.write(weekns[tadays.getDay()]); } </script> </head> <body> <form> <input type="text" id="n1" />年<br /> <input type="text" id="n2" />月<br /> <input type="text" id="n3" />日<br /> <input name="点击我" onClick="wwt()" type="button" value="查询"/> </form> </body> </html>