Heim  >  Artikel  >  Web-Frontend  >  DIV+CSS+JS 变灰弹出层_javascript技巧

DIV+CSS+JS 变灰弹出层_javascript技巧

WBOY
WBOYOriginal
2016-05-16 18:43:04842Durchsuche

浮动层居中的对话框效果演示

\n' + sHTML; dg.innerHTML = sHTML; var dbg = document.createElement("div"); dbg.id = "nd-bdg"; dbg.className = "neat-dialog-bg"; var dgc = document.createElement("div"); dgc.className = "neat-dialog-cont"; dgc.appendChild(dbg); dgc.appendChild(dg); //adjust positioning if body has a margin if (document.body.offsetLeft > 0) dgc.style.marginLeft = document.body.offsetLeft + "px"; document.body.appendChild(dgc); if (bCancel) document.getElementById("nd-cancel").onclick = function() { window.neatDialog.close(); }; this.elt = dgc; window.neatDialog = this; } } NeatDialog.prototype.close = function() { if (this.elt) { this.elt.style.display = "none"; this.elt.parentNode.removeChild(this.elt); } window.neatDialog = null; } function openDialog() { var sHTML = '

你现在看到的是一个层窗口,是被JS控制弹出的,www.jb51.net脚本之家!

'+ '

'; new NeatDialog(sHTML, "欢迎光临!", false); }

浮动层居中的效果


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn