JS 弹出对话框 (遮罩) 透明 ، 可拖动的简单实例
<html> <head> <script> وظيفة salert (txt) {// var esrc = (document.all)؟ window.event.srcelement: وسيطات [1] ؛ var shield = document.createElement ("div") ؛ shield.id = "shield.doS.Style.position =" quistract.style. "0px" ؛ shield.style.width = "100 ٪" ؛ // window.alert (document.body.scrollheight) ؛ shield.style.height = document.body.scrollheight+"px" "10000" ؛ shield.style.filter = "alpha (opitated = 80)" ؛ shield.style.opacity = 0.8 ؛ // shield.style.border-width = shich ؛ strhtml = "<input type =/" button/"value =/" 确 定/"id =/" do_ok/" />/n ris ؛shield.innerhtml = strhtml ؛ document.body.appendChild (shield) ؛ this.dook = function () {document.body.removechild (shield) ؛} document.getElementById ("do_ok"). Focus () ؛} </script> </head> <body> value = 登陆> <p align = center> <select> <bort> --- </orpion> </select> </p> </body> </html> <html> <head> <script> var dragapproved = falsevar minRestore = 0 // 该变量表示窗口目前的状态 , 表示初始化状态 表示初始化状态 1 表示最大化状态 var inialwidth ، initialheight // 若 client 浏览器为 ie5 iECompattest () {return (! window.opera && document.compatmode && document.compatmode! = "backcompat")؟ document.documentElement: document.body} وظيفة drag_drop (e) {if (ie5 && dragapproved && event.button == 1) {document.getElementById ("swindow"). style.left = tempx+event.clientx ofsetx+"px" document.getElementByID ("dwindow"). styp = tempy+event.clienty-OffseTy+"px"}}}} آخر (ns6 && dragapproved) {document.getElementById ("swindow"). style.left = tempx+e.clientx ofsetx+"px" document.getElementByID ("swindow"). style.top = tempy+ event.clientx: e.clientxoffsety = ie5؟ event.clienty: e.clientydocument.getElementByid ("SwindowContent"). style.display = "none" // 此句代码可不要 tempx = parseint (document.getElementById ("swindow"). style.left) tempy = parseint (document.getElementById ("swindow"). style.top) dragappoved = truedocument.getElementById ("dwindow"). onMouseMove = drag_drop} (! ie5 &&! ns6) // 若不为 ie 或 netscpae 浏览器 , 则使用一般的 window.Open 进行弹出窗口处理 //window.open(url ،"،"width=width ، height=height،scrollbars = 1 ") {} آخر {document.getElementById (" swindow "). style.display = '' ؛ document.getElementById (" swindow "). النمط. العرض = initialWidth = width+"px" ؛ document.getElementById ("swindow"). style.height = initialheight = height+"px" ؛ document.getElementById ("swindow"). style.left = "300px" ؛ document.getElementByid ("swindow"). styp = ns6؟ window.pageyoffset*1+30+"px": iECompattest (). WindowDocument.getElementById ("maxName"). setAttribute ("src" ، "layout.png") document.getElementById ("swindow"). style.width = ns6؟ window.innerwidth-20+"px": iecompattest (). clientwidth+"px" document.getElementById ("dwindow"). style.height = ns6؟ window.innerheight-20+"px": iecompattest (). clientheight+"px"} آخر {minRestore = 0 // استعادة windowdocument.getElementById ("maxName"). setAttribute ("src" ، "layout.png") document.getElementById ("swindow"). style.width = initialWidThDocument.getElementById ("dwindow"). style.height = inialHeight} document.getelementByid ("dwindow". window.pagexoffset+"px": iecompattest (). scrollleft+"px" document.getElementById ("swindow"). style.top = ns6؟ window.pageyoffset+"px": iecompattest (). stopDrag () {dragapproved = false ؛ document.getElementById ("swindow"). onMouseMove = null ؛ document.getElementById ("swindowcontent"). style.display = "" // extra} </scprip style = "الموضع: المطلق ؛ خلفية اللون: #ebebb ؛ المؤشر: اليد ؛ اليسار: 0px ؛ الأعلى: 0px ؛ العرض: لا شيء" onmousedown = "initalrag (event)" onMouseup = "stopDrag ()" onSelectStart = "return false"> <div align = "right" styp = id = "maxName" onClick = "maximize ()"> <img src = "icon_delete.gif" onClick = "closeit () OnClick = 'LoadWindow (300،200) ؛'> </body> </html>以上这篇 JS 弹出对话框 (遮罩) 透明 ، 可拖动的简单实例就是小编分享给大家的全部内容了 , 希望能给大家一个参考 , 也希望大家多多支持武林网。