我在asp.net页面写浮动层的脚本 为什么不显示 还是脚本不能用asp.net标记?如果有其他写法希望各位高手帮忙,在线等,有加分!
<script language=javascript>
var specialcode="<DIV id=searchspe style='Z-INDEX: 200; right: 50; POSITION: absolute; TOP: 50px;'><table border='1' width='500' id='table1' bordercolor='#2E6287' height='500'><tr id='NameId'><td vAlign='middle' align='center' width='112'> <asp:label id='Label42' runat='server'>学校名称:</asp:label></td><td width='277'> <asp:textbox id='Name1' runat='server' Width='256px'></asp:textbox></td><td id='checkName1' width='200'></td></tr></table></DIV>";document.write(specialcode);lastScrollY=0;function heartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent>0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollY=lastScrollY+percent;}window.setInterval("heartBeat0()",1);
</script>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.Panel1.Style["position"] = "absolute";
this.Table1.Style["filter"] = "Alpha(opacity=75)";
}
} protected void Button2_Click(object sender, EventArgs e)
{
this.TextBox1.Text = this.TextBox3.Text + " 被后台处理";
this.TextBox2.Text = DateTime.Now.ToLongTimeString() + " 被后台处理";
this.Panel1.Visible = false;
} protected void Button1_Click(object sender, EventArgs e)
{
this.Panel1.Visible = true;
}</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>演示半透明遮罩</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" Visible="false">
<asp:Table ID="Table1" runat="server" BackImageUrl="http://img2.3lian.com/img2007/19/14/004.jpg"
Height="531px" Width="850px">
<asp:TableRow>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center">
这里是浮动的内容 ------------------------- 这里是浮动的内容<br />
这里是浮动的内容 ------------------------- 这里是浮动的内容<br />
这里是浮动的内容 ------------------------- 这里是浮动的内容<br />
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="测试2" OnClick="Button2_Click" />
</asp:TableCell></asp:TableRow>
</asp:Table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
这里是不浮动的内容 <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
这里是不浮动的内容 <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
这里是不浮动的内容<br />
<asp:Button ID="Button1" runat="server" Text="测试1" OnClick="Button1_Click" />
</td>
</tr>
</table>
</form>
</body>
</html>
这里,使用Panel(即客户端看起来的DIV)。当它不显示的时候,Panel中的内容并不需要下载到客户端。
不能用的。
你可以用<input type="text">这样的标记,然后在js里给它们复制,可以在page_Load里给这个HTML控件赋值的。
Ajax也是工作在客户端的,所以还是不行。
Request.Forms["userName"]
Request["username"]
上面的方法都能获取到值的。