JS 弹出对话框 (遮罩) 透明, 可拖动的简单实例
<Html> <A-head> <script> fonction Salert (txt) {// var esrc = (document.all)? window.event.srcelement: arguments [1]; var shield = document.createelement ("div"); shield.id = "shield"; shield.style.position "; should.tild.stystyle.left =" 0px "; "0px"; shield.style.width = "100%"; // window.alert (document.body.scrollheight); shield.style.height = document.body.scrollheight + "px"; shield.style.background = "white "10000"; shield.style.filter = "alpha (opacity = 80)"; shield.style.opacity = 0.8; // shield.style.border-width = épais; strhtml = "<input type = /" Button / "value = /" 确 定 / "id = /" DO_OK / "onClick = /" DOOK () / ") />/n" ;shield.innerhtml = strhtml; document.body.appendchild (shield); this.dook = function () {document.body.removechild (shield);} document.getElementyid ("do_ok"). focus ();} </cript> </head> <body> <entrée type = Button on onClick = "Salertre Value = 登陆> <p align = Center> <lelect> <Option> --- </ Option> </ Select> </p> </ body> </html> <html> <éad- head> <script> var dragapproved = falsevar minRestore = 0 // 该变量表示窗口目前的状态 , 0 表示初始化状态 , 1 表示最大化状态 var initialWidth, initialHeight // 若 client 浏览器为 ie5.0 以上版本的 var ie5 = document.all && document.getElementById // 若 client 浏览器为 netcape6。0 版本以上的 var ns6 = document.getelement &&! ieCompattest () {return (! window.opera && document.compatmode && document.compatmode! = "backcompat")? document.DocumentElement: document.body} fonction drag_drop (e) {if (ie5 && dragApproved && event.button == 1) {document.getElementById ("Downow"). Style.left = tempx + event.clientx-offsetx + "px" document.getElementyid ("Downdow"). STYLE.TOP = TEMPY + event.clienty-Offsety + "px"} else if (ns6 && dragapproved) {document.getElementById ("Downow"). Style.left = tempx + e.clientx-offsetx + "px" document.getElementById ("Downdow"). Style.top = TEMPY + E.Clienty-Offsety + "PX"}} fonction initialisation (e) {offsetx = ie5? event.clientx: e.clientxoffsety = ie5? event.clienty: e.clientyDocument.getElementById ("DownowContent"). Style.display = "Aucun" // 此句代码可不要 Tempx = paSeInt (document.getElementById ("Downow"). Style.left) tempy = paSeInt (document.getElementById ("Downow"). Style.top) DragApproved = TreeDocument.getElementById ("Dwindow"). OnMouseMove = Druedrop} Fonction LoadWindow (width, Height) {Hight) {Hight) {if (! IE5 &&! NS6) // 若不为 c'est-à-dire 或 netscpae 浏览器 , 则使用一般的 window.open 进行弹出窗口处理 //window.open(url ," ,"width=width ,height=height,scrollbars = 1 ") {} else {document.getElementById (" Downow "). Style.display = ''; document.getElementById (" Downow "). Style. width = initialWidth = width + "px"; document.getElementById ("Downdow"). style.height = initialHeight = height + "px"; document.getElementById ("Downdow"). style.left = "300px"; document.getElementyid ("dwindow"). style.top = ns6? window.pageyoffset * 1 + 30 + "px": ieCompattest (). ScrollTop * 1 + 30 + "px"; // document.getElementById ("cframe"). src = url}} function maximize () {if (MinRestore == 0) {mineRstore = 1 // Maximize windowDocument.getElementById ("maxName"). setAttribute ("src", "Layout.png") document.getElementById ("Downow"). style.width = ns6? window.innerwidth-20 + "px": ieCompattest (). ClientWidth + "px" document.getElementById ("Downow"). style.height = ns6? window.innerheight-20 + "px": ieCompattest (). ClientHeight + "px"} else {minestore = 0 // restaurer windowDocument.getElementById ("maxName"). SetAttribute ("Src", "Layout.png") document.getElementById ("DIDINDOW"). style.width = initialWidthDocument.getElementByid ("Dwindow"). STYLE.HEight = InitialHeight} document.GetElementByid ("Dwindow"). window.pagexoffset + "px": ieCompattest (). Scrollleft + "px" document.getElementById ("Downow"). Style.top = ns6? window.pageyoffset + "px": ieCompattest (). ScrollTop + "px"} fonction closeit () {document.getElementById ("Downow"). style.display = "NONE"} fonction stopSdrag () {dragApproved = false; document.getElementById ("Downow"). OnMouSemove = null; document.getElementById ("DownDowContent"). Style.display = "" // Extra} </cript> </-head> <pody> <div id = "Dwindow" Style = "Position: Absolute; Background-Color: #ebebeb; Cursor: main; gauche: 0px; top: 0px; affichage: Aucun" OnMoudown = "initializedrag (événement)" OnMouseUp = "stopdrag ()" onselectStart = "return false"> <div align = "droite" style = "background-Color: NAVY"> <img src = "courir" id = "maxName" onClick = "maximize ()"> <img src = "icon_delete.gif" onclick = "closeit ()"> </ div> <div id = "DowndowContent" style = "height: 100%"> </ div> </ div> <intrut type = "bouth" value = "弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口 弹出窗口" onClick = 'LoadWindow (300,200);'> </ody> </html>以上这篇 JS 弹出对话框 (遮罩) 透明, 可拖动的简单实例就是小编分享给大家的全部内容了 , 希望能给大家一个参考 , 也希望大家多多支持武林网。