比如我要打开一个www.xxx.com/xxx.aspx,在地址中输入www.xxx.com/xxx.aspx即可,但是如果xxx.aspx中包含bb.js文件。如果我想打开xxx.aspx页面并且执行bb.js中的方法cc。怎么在地址栏中直接输入地址可以做到这样?
在php中看到好像这样即可www.xxx.com/xxx.php#cc()
但是在asp.net中如何做到?
在php中看到好像这样即可www.xxx.com/xxx.php#cc()
但是在asp.net中如何做到?
?
在aspx页面的body标签里定义事件onload=<%=cs里的变量%>。没试过,
cs:
public string xxx = null;
protected void Page_Load(object sender, EventArgs e)
{
xxx = Request.QueryString["funName"];
}aspx:
<script type="text/jscript">
function lo(fun)
{
if(fun=="aa")
aa();
if(fun="bb")
bb();
}
function bb()
{
}
function aa()
{
}
</script>
aspx:
<head runat="server">
<title>无标题页</title>
<script type="text/jscript">
function lo(fun)
{
if(fun==="aaa")
{aa();}
if(fun==="bb")
{bb();}
}
function bb()
{
alert("bb");
}
function aa()
{
alert("aa");
}
</script>
</head>
<body onload="lo('<%=qq%>')">
<form id="form1" runat="server">
<div>
<asp:Label ID="la" runat=server></asp:Label>
</div>
</form>
</body>
cs: public string qq = null;
protected void Page_Load(object sender, EventArgs e)
{
qq = Request.QueryString["funName"];
}