s代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
function
show_more_mess()
{
$(
"#background_div"
).css(
"width"
,
"100%"
);
//获取这个div的时候是没有问题的
$(
"#background_div"
).css(
"height"
,
"100%"
);
$(
"#background_div"
).css(
"position"
,
"absolute"
);
$(
"#background_div"
).css(
"left"
,
"0"
);
$(
"#background_div"
).css(
"top"
,
"0"
);
$(
"#background_div"
).css(
"display"
,
"block"
);
alert(document.getElementById(
"more_mess"
).innerHTML);
//这边是作测试用的,报错显示获取不到这个元素
}
function
show_div()
{
$(
"#more_mess"
).css(
"display"
,
"block"
);
//这边没有象没有执行一样
}
|
asp.net前台代码
1
2
3
4
5
6
7
|
<div id=
"background_div"
runat=
"server"
style=
"position:absolute; display:none; background:#999999; filter:Alpha(opacity=50)"
>
</div>
<div id=
"more_mess"
runat=
"server"
style=
"position:absolute;width:100px; height:100px; background:red; display:none; z-index:10"
>
<div>账户:<asp:TextBox ID=
"TextBox_show_username"
runat=
"server"
></asp:TextBox></div>
<div>密码:<asp:TextBox ID=
"TextBox_show_pwd"
runat=
"server"
></asp:TextBox></div>
</div>
|
asp.net后台代码
1
2
3
4
5
6
7
8
9
10
11
12
|
background_div.InnerHtml =
"<script>show_more_mess();"
;
try
{
TextBox_show_pwd.Text =
"a"
;
TextBox_show_username.Text =
"b"
;
background_div.InnerHtml =
"<script>show_div();</script>"
;
//后台是可以获取到more_mess这个div的
}
catch
(Exception ee)
{
}
|
感觉很奇怪 希望高手能帮我看一下问题出在什么地方