一个URL怎么给.NET或者html页面传递参数并包含在页面JS中去

来源:百度知道 编辑:UC知道 时间:2024/06/04 09:17:19
我要做一个页面用来传递参数,那个页面怎么获取?
比如我的URL是:http://zhidao.baidu.com/abc.html?ID=123456 这个链接
(abc.html或者abc.aspx页面 123456为要传递的参数 )

abc页面内容是一个JS语句,需要获得123456这个参数。
内容如下:
<html>
<head><title>在线聊天</title>
</head>
<body>
<script>
location.href='OPK://Messages/?uid=0&target=123456';
setTimeout('window.opener=null;window.close()', 1 );
</script>
</body>
</html>

请问这个ABC页面如何写?用HTML JS写 或者用.NET写 谢谢您!

在 .cs 文件里定义一个全局变量,在page_load里接收参数处理

cs文件处理
public testStr;
protected void Page_Load(object sender, EventArgs e)
{
testStr = Request.QueryString["ID"];
}

aspx文件处理
<html>
<head><title>在线聊天</title>
</head>
<body>
<script>
location.href='OPK://Messages/?uid=0&target=<%=testStr%>';
setTimeout('window.opener=null;window.close()', 1 );
</script>
</body>
</html>