我想实现在网页中,打开页面,判断是否用户已经登录,如果没有登录,则提示用户进行登录,像QQ一样弹出一个页面,父窗体变灰就不能操作。
我用JS写了段脚本,实现这个功能,但是在IE6下面父窗体没有变灰,而且能操作,没有达到预期的效果,但是IE7跟8都没问题
请教各位牛人,帮忙指点下JS代码function createDiv() { var shadow = document.createElement("div");
shadow.setAttribute("id", "shadow");
// shadow.style.zIndex = "10";
var box = document.getElementById("GridViewDIV");
box.style.zIndex = "99";
box.style.top = "50%";
box.style.left = "50%";
document.body.appendChild(shadow);
}
function hideDiv() {
var box = document.getElementById("GridViewDIV");
var shadow = document.getElementById("shadow");
box.style.display = "none";
box.style.zIndex = "0";
box.style.top = "0";
box.style.left = "0";
document.body.removeChild(shadow);
return true;
}CSS样式
.style1
{
width: 97%;
}
#shadow
{
position:absolute;
left:0;
top:0;
right:0;
bottom:0;
margin:0px 0px 0px 0px;
width:100%;
height:100%;
background-color:#0060C0;
filter:alpha(opacity=20);
}
#GridViewDIV{
position:absolute;
left:50%;
top:50%;
width:400px;
height:180px;
margin:-90px 0 0 -200px;
border:1px solid #84A0C4;
background-color:#DFE8F6;
text-align:center;
}
.style4
{
height: 80px;
}
.style5
{
height: 6px;
}页面中定义了一个名为GridViewDIV的DIV
我用JS写了段脚本,实现这个功能,但是在IE6下面父窗体没有变灰,而且能操作,没有达到预期的效果,但是IE7跟8都没问题
请教各位牛人,帮忙指点下JS代码function createDiv() { var shadow = document.createElement("div");
shadow.setAttribute("id", "shadow");
// shadow.style.zIndex = "10";
var box = document.getElementById("GridViewDIV");
box.style.zIndex = "99";
box.style.top = "50%";
box.style.left = "50%";
document.body.appendChild(shadow);
}
function hideDiv() {
var box = document.getElementById("GridViewDIV");
var shadow = document.getElementById("shadow");
box.style.display = "none";
box.style.zIndex = "0";
box.style.top = "0";
box.style.left = "0";
document.body.removeChild(shadow);
return true;
}CSS样式
.style1
{
width: 97%;
}
#shadow
{
position:absolute;
left:0;
top:0;
right:0;
bottom:0;
margin:0px 0px 0px 0px;
width:100%;
height:100%;
background-color:#0060C0;
filter:alpha(opacity=20);
}
#GridViewDIV{
position:absolute;
left:50%;
top:50%;
width:400px;
height:180px;
margin:-90px 0 0 -200px;
border:1px solid #84A0C4;
background-color:#DFE8F6;
text-align:center;
}
.style4
{
height: 80px;
}
.style5
{
height: 6px;
}页面中定义了一个名为GridViewDIV的DIV
解决方案 »
- reflector的使用问题,求高手!
- 发表评价处,被群发器留下一段码
- 生成固定长度的编号
- 用js给gridview中的textbox赋值
- Session 共享问题 在不同的虚拟目录下共享Session
- 有人使用过InfoPath 2003 + vs.net 2005做软件开发吗?
- 软件行业发展的趋势,以后会不会稍大的公司都为自己配一支软件研发团队?
- 救救我大虾们!!!!!!!!!在我添加自定义web控件的时候有个问题,我不懂,谢谢帮我解决!!!急---急----急======================
- 一个有建设性的问题.懂不懂的都来看看.都能看明白的
- asp.net 遍历实体对象 赋空值
- DataBinding:“System.Data.DataRowView”不包含名为“listcar_type”的属性。
- 好的团队和团队氛围有多重要??
楼主完成后能否传我一份看看,我也正要做个类似功能的页面
Email [email protected]
好人一生平安
通过JQUERY弹出模式窗口实现登录
参考
filter:alpha(opacity=20);
不兼容ie6
看看这个对你有没有帮助:
http://www.8tops.com/113_kavenyan_916387B12A6C4D088D48E7F9AB3F4405.htm
这是我自己做的一个仿关机效果弹出式登录窗口(Asp.net 2.0+Ajax),不知道对LZ有没有帮助,看看吧~
http://topic.csdn.net/u/20090608/16/54579a1f-5932-44c2-886d-0b2c0268237c.html?48609
两个参考。两个都还可以。要现成的就到第二个里面去下吧。
加大下SHADOW的Z-INDEX试下
在ModalPopupExtender悬停中,要保护背景不被点击,所以加入如下样式..在FF和IE下都可以将除了悬停之外的背景显示为灰色...backgroundCss
{
background-color:Gray;
filter:alpha(opacity=80);
opacity:0.8;
}