最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js實現(xiàn)仿網易點擊彈出提示同時背景變暗效果

 更新時間:2015年08月13日 15:56:49   作者:企鵝  
這篇文章主要介紹了js實現(xiàn)仿網易點擊彈出提示同時背景變暗效果,涉及javascript彈出框及頁面元素樣式操作的相關技巧,非常具有實用價值,需要的朋友可以參考下

本文實例講述了js實現(xiàn)仿網易點擊彈出提示同時背景變暗效果。分享給大家供大家參考。具體如下:

這里仿網易點擊彈出提示,背景變暗提示層效果,圓角,美觀簡潔,代碼稍嫌多。

運行效果如下圖所示:

在線演示地址如下:

http://demo.jb51.net/js/2015/js-sina-dialog-bgcolor-codes/

具體代碼如下:

<html>
<head>
<title>點擊彈出提示,背景變暗</title>
<script>
function msg(info){
var p=document.createElement("DIV");
if (!info) var info='<a href="#" target="_blank" rel="external">歡迎光臨</a>';
p.id="p";
p.style.position="absolute";
p.style.width=document.body.scrollWidth;
p.style.height=(document.body.offsetHeight>document.body.scrollHeight)?'100%':document.body.scrollHeight;
p.style.zIndex='998';
p.style.top='0px';
 p.style.left='0%';
p.style.backgroundColor="gray";
p.style.opacity='0.5';
p.style.filter="alpha(opacity=80)";
document.body.appendChild(p);
var p1=document.createElement("DIV");
var top=parseInt(parseInt(document.body.scrollHeight)*0.25)+document.body.scrollTop;
p1.style.position="absolute";
p1.style.width="300px";
p1.id="p1";
var left=Math.ceil(((document.body.scrollWidth)-parseInt(p1.style.width.replace('px','')))/2)+document.body.scrollLeft;
p1.style.height="200px";
p1.style.zIndex='999';
p1.style.top=top+'px';
 p1.style.left=left+'px';
p1.style.border="0px solid red";
var html="";
 html+="<center>"
 html+="<div class='p3' style='height:1px;overflow:hidden;background:red;width:294px;border-left:1px solid red;border-right:1px solid red;'></div>"
 html+="<div class='p2' style='height:1px;overflow:hidden;background:red;width:296px;border-left:1px solid red;border-right:1px solid red;'></div>"
 html+="<div class='p2' style='height:1px;overflow:hidden;background:red;width:298px;border-left:1px solid red;border-right:1px solid red;'></div>"
 html+="<div class='p1' style='height:20px;overflow:hidden;background:red;width:300px;border-left:1px solid red;border-right:1px solid red;color:#fff;font-size:9pt;font-weight:bold;text-align:left;'> ⊙ 友情提示:</div>"
html+="<div id='c' style='height:150px;width:300px;background-color:#FEEACB;overflow:hidden;border-left:1px solid red;border-right:1px solid red;padding-top:40px;font-size:9pt;'>"+info+"<br><br><br>[ <a href='javascript:this.cancle()'> 關閉</a> ]</div>"
 html+="<div class='p1' style='height:1px;overflow:hidden;background:#FEEACB;width:298px;border-left:1px solid red;border-right:1px solid red;'></div>"
 html+="<div class='p2' style='height:1px;overflow:hidden;background:#FEEACB;width:296px;border-left:1px solid red;border-right:1px solid red;'></div>"
 html+="<div class='p3' style='height:1px;overflow:hidden;background:red;width:294px;border-left:1px solid red;border-right:1px solid red'></div>"
 html+="</center>"
document.body.appendChild(p1);
p1.innerHTML=html;
var arr=document.getElementsByTagName("select");
var i=0;
while(i<arr.length){
 arr[i].style.visibility='hidden';
 i++;
}
this.cancle=function(){
document.body.removeChild(document.getElementById('p'));
document.body.removeChild(document.getElementById('p1'));
var arr=document.getElementsByTagName("select");
 var i=0;
 while(i<arr.length){
 arr[i].style.visibility='visible';
 i++;
 }
}
}
</script>
</head>
<body>
<input value='點擊彈出提示' type='button' onClick='msg()' />
</body>
</html>

希望本文所述對大家的javascript程序設計有所幫助。

相關文章

最新評論

古蔺县| 罗江县| 大石桥市| 宜城市| 武鸣县| 田东县| 洮南市| 车致| 余庆县| 纳雍县| 福清市| 商都县| 天津市| 大埔县| 北宁市| 宁都县| 乌海市| 麻城市| 工布江达县| 新源县| 宁强县| 滨州市| 历史| 崇义县| 井冈山市| 华亭县| 郴州市| 宝兴县| 合山市| 闸北区| 永定县| 丽水市| 靖州| 长海县| 河东区| 青河县| 贺兰县| 高州市| 富裕县| 镇远县| 东城区|