JS 弹出对话框 (遮罩) 透明, 可拖动的简单实例
<html> <fead> <script> function salert (txt) {// var esrc = (document.all)? Window.event.SrCelement: argumentos [1]; var shield = document.createElement ("div"); shield.id = "shield"; shield.style.position = "absoluto"; shield.style.left = "0px"; shield.tyle "0px"; shield.style.width = "100%"; // window.alert (document.body.scrollheight); shield.style.height = document.body.scrollheight+"px"; shield.style.background = "white"; shield.style.textalign = "shield.style.zindex =" 10000 "10000"; = "alpha (opacidad = 80)"; shield.style.opacity = 0.8; // shield.style.border-width = grueso; strhtml = "<input type =/" button/"valor =/" 确 定/"id =/" do_ok/"onClick =/" dook ()/"/>//n";shield.innerhtml =" strhtml; document.body.appendChild (shield); this.dook = function () {document.body.removechild (shield);} document.getElementById ("do_ok"). focus ();} </script> </head> <body> <body type = botton en elclick = "salert ('登陆成功!')" Valor = 登陆> <p. Align = Center> <ecteling> <pection> --- </ppection> </select> </p> </body> </html> <html> <fead> <script> var dragAppRoved = falsevar minrestore = 0 // 该变量表示窗口目前的状态 , 0 表示初始化状态 , 1 表示最大化状态 var inicialwidth, inicialHeight // 若 Cliente 浏览器为 IE5.0 以上版本的 var ie5 = document.all && document.getElementByid // Client iecompattest () {return (! Window.opera && document.compatmode && document.compatmode! = "BackCompat")? document.documentelement: document.body} function drag_drop (e) {if (ie5 && dragApproved && event.button == 1) {document.getElementById ("dwindow"). style.left = tempx+event.clientx offsetx+"px" document.getElementById ("dwindow"). style.top = temppy+event.clienty offetsety+"px" más si si if si (ns6 && dragAppRoved) {document.getElementById ("dwindow"). style.left = tempx+e.clientx ofsetssetx+"px" document.getElementById ("dwindow"). style.top = temppy+e.clienty-offsety+"px"} function inicializedrag (e) {offsetx = ie5? Event.Clientx: e.ClientxOffSety = IE5? Event.clienty: e.clientydocument.getElementById ("dwindowcontent"). style.display = "Ninguno" // 此句代码可不要 tempx = parseInt (document.getElementById ("dwindow"). Style.left) temppy = parseInt (document.getElementById ("dwindow"). Style.top) dragApproved = triDocument.getElementById ("dwindow"). (! ie5 &&! ns6) // 若不为 若不为 或 或 netscpae 浏览器 , 则使用一般的 window.open 进行弹出窗口处理 //window.open(url,"! = 1 ") {} else {document.getElementById (" dwindow "). Style.display = ''; document.getElementById (" Dwindow "). Style. width = inicialwidth = width+"px"; document.getElementById ("dwindow"). style.height = inicialHeight = Height+"Px"; document.getElementById ("dwindow"). style.left = "300px"; document.getElementByid ("dwindow"). style.top = ns6? Window.PageyOffset*1+30+"Px": iecompattest (). ScrollTop*1+30+"Px"; // document.getElementById ("cFrame"). src = url}} function maximize () {if (minrestore == 0) {minrestore = 1 // maximize WindowDocument.getElementById ("MaxName"). SetAttribute ("Src", "Layout.png") document.getElementById ("dwindow"). style.width = ns6? Window.innerWidth-20+"Px": iecompattest (). ClientWidth+"Px" document.getElementById ("Dwindow"). Style.Height = NS6? Window.innerHeight-20+"PX": iecompattest (). ClientHeight+"PX"} else {minrestore = 0 // restauración WindowDocument.getElementById ("maxname"). setAttribute ("src", "layout.png") document.getElementById ("dwindow"). style.width = in ItialWidthDocument.getElementById ("Dwindow"). style.height = inicialHeight} document.getElementById ("Dwindow"). style.left = ns6? Window.PagexOffset+"Px": iecompattest (). ScrollLeft+"PX" Document.getElementById ("Dwindow"). style.top = ns6? Window.PageyOffset+"Px": iecompattest (). scrolltop+"px"} function closeit () {document.getElementById ("dwindow"). style.display = "none"} function stopDrag () {dragAppRoved = false; document.getElementById ("dwindow"). onmouseMove = null; document.getElementById ("dwindowcontent"). style.display = "" // extra} </script> </head> <body> <d id = "dwindow" style = "Position: Absolute; Background-Color: #ebebeb; cursor: hand; izquierda: 0px; top: 0px; visual id = "maxname" onClick = "maximize ()"> <img src = "icon_delete.gif" onClick = "Closeit ()"> </div> <div ID = "dwindowContent" style = "altura: 100%"> </div> </div> <input type = "bootle" valor = "弹出窗口" onClick = 'LoadWindow (300,200);'> </body> </html>以上这篇 JS 弹出对话框 (遮罩) 透明, 可拖动的简单实例就是小编分享给大家的全部内容了 , 希望能给大家一个参考 也希望大家多多支持武林网。