<%
'Page B:
option explicitdim sql
sql="INSERT INTO MyTable(MyValue) VALUES('" & request.form("ValueControl") & "')"dim rsExecute'MyConnection对象已经创建,是连接数据库的connection对象set rsExecute=MyConnection.execute(sql)
%><html>
<body>
页面将会在1秒钟后自动返回
<script language="javascript" type="text/javascript">
function ReturnBack()
{
window.navigate("C.asp");
}var obj=setTimeout("ReturnBack()",1000);
</script>
</body>
</html>
这是B页面的代码逻辑,请大家帮忙,谢谢!
<%
option explicit
%><html>
<body>
<form name="MyForm" method="post" action="B.asp">
Value:<input type="text" name="ValueControl" size="10">
<input type="submit" name="SubmitForm" value="提交">
</form>
</body>
</html>
这是A页面,很简单的
{
//window.navigate("C.asp");
window.location.href="c.asp"; //先试试这样,看看是不是navigate的问题,或者是c页面有问题,或是在a页面提交了两次,你也可以用抓包工具看看是那个页面提交了两次
}
function ReturnBack()
{
window.navigate("C.asp");
clearTimeour(obj);//清下
}var obj=setTimeout("ReturnBack()",1000);
</script>
<script language="javascript" type="text/javascript">
function ReturnBack()
{
window.navigate("C.asp");
clearTimeout(obj);//清下
}var obj=setTimeout("ReturnBack()",1000);
</script>
'Page B:
option explicitdim sql
sql="INSERT INTO MyTable(MyValue) VALUES('" & request.form("ValueControl") & "')"dim rsExecute'MyConnection对象已经创建,是连接数据库的connection对象set rsExecute=MyConnection.execute(sql)
response.Write"<meta http-equiv='refresh' content='1;url=index.asp'>"
%>这样就行了
为什么还要用JS的setTimeout
'Page B:
option explicitdim sql
sql="INSERT INTO MyTable(MyValue) VALUES('" & request.form("ValueControl") & "')"dim rsExecute'MyConnection对象已经创建,是连接数据库的connection对象set rsExecute=MyConnection.execute(sql)
response.Write"<meta http-equiv='refresh' content='1;url=C.asp'>"
%>