定时提交功能~~~高分相送
想做一个定时提交按钮,由于对JavaScript不了解,希望高手指点一下,有没有什么好的方法。
我的方法如下,就是在 <script 里面不知道如何调用后面的提交按钮~~
(我这里是想调用Button1的事件)
<head runat= "server ">
<title> 无标题页 </title>
</head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<script language= "JavaScript ">
var intLeft = 15; // Seconds until navigation occurs
function leavePage() {
if (0 == intLeft) // Time is up--navigate.
alert( 'BOMB!!!哈哈!这里还可以换成超级连接。 ') // 我的思路是在这一部分调用下面的提交按钮
else {
// Count down and output updated time by
// changing the contents of the element.
intLeft -= 1;
document.all.countdown.innerText = intLeft + " ";
// Wait another second.
setTimeout( "leavePage() ", 1000);
}
}
</script>
<body onLoad= "setTimeout( 'leavePage() ', 1000) ">
<form id= "form1 " runat= "server ">
<div>
<span id= "countdown "> <!-- Output initial amount of time. -->
<script language= "JavaScript ">
document.write(intLeft);
</script>
</span>
欢迎你 <asp:Label ID= "LabelName " runat= "server " Text= "Label "> </asp:Label>
<asp:Button ID= "Button1 " runat= "server " OnClick= "Button1_Click " Text= "提交 " /> </div>
</form>
</body>
</html>
[解决办法]
form1.submit()
[解决办法]
提交是已form提交的,不是以按键提交的,按键也必须提交表单才行
type为submit的按键点击之后是在哪个form中就提交那个form
[解决办法]
你的form里面就一个input,你还想提交什么?
form1.submit()是可以提交表单的,但是不会执行服务器端的Button1_Click那段
[解决办法]
form1.submit()是提交form1中所有input,select,textarea的内容。以name1=value1&name2=value2&name3=value3...这样的方式去提交给客户端。这样的提交也叫post提交。
有时间你可以看看post/get提交的区别。百度一搜一大堆。
[解决办法]
如果你想执行form1.submit(),请确认form1中没有名字叫submit的按钮。