<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>
按钮要加id,如下,你可以保存html格式看一下运行效果<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
function tiaozhuan() {
var text1 = document.getElementById("input").value//获取按钮的值
var myurl = "https://www.baidu.com/s?wd=" + text1//拼接网址和获取的值
window.location.assign(encodeURI(myurl)) //跳转到拼接好的地址
}
</script>
<input type="button" id="input" value="test" onclick="tiaozhuan()" />
</body>
</html>