弹出div窗口,背景变色

HTML与JavaScript页面遮罩效果
<! 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 >
< meta  http-equiv ="Content-Type"  content ="text/html; charset=utf-8"   />
< title > xland.cn </ title >
< style >
*
{ padding:0; margin:0; font-size:12px;}
#bg
{background:#000000;opacity: 0.5;-moz-opacity:0.5; filter:alpha(opacity=50); width:100%; height:100%;position:absolute; top:0; left:0}
#info
{height:0px; width:0px;top:50%; left:50%;position:absolute;  line-height:1.7}
#center
{background:#fff;border:1px solid #217AC1; width:300px; height:100px; position:absolute; margin:-50px -150px;}
#center strong
{ display:block; padding:2px 5px; background:#EBF4FC; color:#519FEE;}
#center p
{padding:10px; text-align:center; color:#1C6FB8;}
</ style >
</ head >
< body >
< span  id ="boxs" ></ span >
< href ="javascript:boxs(1);" > 点这里测试一下 </ a >
< script >
function boxs(v){
 window.scrollTo(
0,0);
 
var bo = document.getElementsByTagName('body')[0];
 
var ht = document.getElementsByTagName('html')[0];
 
var boht = document.getElementById('boxs');    
 boht.innerHTML 
= '';
 bo.style.height
='auto';
 bo.style.overflow
='auto';
 ht.style.height
='auto'
 
if(v == 1){   
  bo.style.height
='100%';
  bo.style.overflow
='hidden';
  ht.style.height
='100%';  
  boht.innerHTML 
= '<div id="bg"></div><div id="info"><div id="center"><strong>友情提醒:</strong><p><a href="javascript:boxs(0);">关闭</a></p></div></div>';   
 }

}
 
</ script >< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  /> 11 < br  />< br  />< br  />< br  />< br  />< br  /> 11 < br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  /> xland.cn < br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  />< br  /> xland.cn
< href ="javascript:boxs(1);" > 点这里测试一下 </ a >
</ body >
</ html >  
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

liulun

如果文章真帮到了你,谢谢您打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值