Default.aspx页面:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="chuanzhiye.aspx?id=5&name=gz" >传值测试</a>
</div>
</form>
</body>
</html>
chuanzhiye.aspx页面:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" language="javascript">
function GetQueryString(name){
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
var r = window.location.search.substr(1).match(reg);
if (r!=null)
return unescape(r[2]);
return null;
}
function Get(){
alert(GetQueryString('id'));
alert(GetQueryString('name'));
}
</script>
</head>
<body οnlοad="Get();">
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="获取url参数"/>
</div>
</form>
</body>
</html>