怎样定时自动提交如下表单?

1<form action="index1.asp" method="post" name="sendvalue">
2<input name="username" type="text"/>
3<input name="password" type="password"/>
4</form>

要求是,每隔一秒种就自动提交一次。最好是不要看到提交的内容。就象在后台运行一样。该如何做呢?提交的时候,该页面是不能离开的。。。
---------------------------------------------------------------

1@LANGUAGE="VBSCRIPT" CODEPAGE="936"
 1<html>
 2<head>
 3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 4<title>无标题文档</title>
 5</head>
 6<script language="JavaScript" type="text/JavaScript">   
 7function Login(username,password)   
 8{   
 9var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")   
10xmlHttp.open("POST", "index1.asp?username="+username+"&password="+password,false)   
11xmlHttp.send()   
12var re=xmlHttp.responseText;   
13alert(re);   
14setTimeout("Login(sendvalue.username.value,sendvalue.password.value)",1000);   
15}   
16</script>
17<body>
18<form method="post" name="sendvalue">
19<input name="username" type="text"/>
20<input name="password" type="password"/>
21<input name="ok" onclick="Login(sendvalue.username.value,sendvalue.password.value)" type="button" value="提交"/>
22</form>
23</body>
24</html>

---------------------------------------------------------------

1<script>   
2function sendData(){   
3var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");   
4xmlhttp.Open("POST", "index1.asp?username="+sendvalue.username.value+"&password="+sendvalue.password.value", false);   
5xmlhttp.Send("");   
6setTimeout("sendData()",1000);   
7}   
8</script>
1<body onload="sendData()">
2</body>
Published At
Categories with Web编程
comments powered by Disqus