全屏友情提示

css代码:

* { 
    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;
}

 

javascript代码:

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>';   
 }

}
 

 

html代码:

< 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 = '
友情提醒:

关了我吧!

'; } } </script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值