国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

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

2019-11-20 11:49:50
字體:
供稿:網(wǎng)友

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

這里仿網(wǎng)易點(diǎn)擊彈出提示,背景變暗提示層效果,圓角,美觀簡(jiǎn)潔,代碼稍嫌多。

運(yùn)行效果如下圖所示:

在線演示地址如下:

http://demo.VeVB.COm/js/2015/js-sina-dialog-bgcolor-codes/

具體代碼如下:

<html><head><title>點(diǎn)擊彈出提示,背景變暗</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()'> 關(guān)閉</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='點(diǎn)擊彈出提示' type='button' onClick='msg()' /></body></html>

希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 清涧县| 那曲县| 湖北省| 商丘市| 彰武县| 梨树县| 旬阳县| 城口县| 卓资县| 田林县| 凤阳县| 麻城市| 新营市| 白山市| 保康县| 长武县| 江西省| 萍乡市| 甘南县| 金堂县| 栾川县| 辽中县| 务川| 平遥县| 东阿县| 大关县| 连平县| 彝良县| 玉龙| 威信县| 思茅市| 康平县| 吴堡县| 临江市| 长丰县| 于都县| 五家渠市| 白城市| 巢湖市| 海林市| 营口市|