<head runat="server">
<title></title>
<script type="text/javascript" src="http://include.manmango.com/js/jquery-1.6.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var c = 2
var timeVal = setInterval(function () {
$("#timer").val(c)
if(c == 0){
clearTimeout(timeVal)
window.location.href = "Default2.aspx?user_id=" + $("#Label1").text() //向页面Default2传递值
}
c--
}, 1000)
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="timer" runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server" >5</asp:Label>
</div>
</form>
</body>
</html>
有时候,为了隐藏页面之间传递的参数,不会用直接路由加参数的形式去跳转,而是利用post方法,我们都知道post方法传递参数时,参数并不现实在url里面
post传参并跳转
<form action="XXX" method="post"><input type='text' id='name' name='name'>
<input type='submit' id='zouni' value='提交'>
</form>
form表单提交,可通过method="post"设置get或post请求,<input name='XXX'>为提交参数名为XXX的参数