JS 弹出对话框 (遮罩) 透明, 可拖动的简单实例
<html> <head> <script> function salert (txt) {// var esrc = (document.all)? window.event.srcelement: аргументы [1]; var shield = document.createElement ("div"); shield.id = "shield"; shield.style.position = "absolute"; shield.style.left = "0Px -style.position =" Absolute "; shield.style.left. "0px"; shield.style.width = "100%"; // window.alert (document.body.scrollheight); shield.style.height = document.body.scrollheight+"px"; shield.style.background = "белый"; shield.style.textalign = "; "10000"; shield.style.filter = "alpha (непрозрачность = 80)"; shield.style.opacity = 0.8; // shield.style.border-width = wrotle; strhtml = "<input type =/" "value =/" 确 定/"id =/" do_ok/"onclick =/" dook =/"确 定/" id =/"do_ok/" onclick =/"" ()/"确 定 定/" "strhtml =" Onclick =/""/"确 定/" "strhtml =" on-onclic />/n";shield.innerhtml = strhtml; document.body.appendchild (щит); this.dook = function () {document.body.removechild (щит);} document.getElementbyId ("do_ok"). Focus ();} </script> </head> <body> <input onclick onclick = "} <) </script> </head> <body> <input = onclick =") </script> </head> <body> <input = onclick = ") value = 登陆> <p align = center> <select> <опция> --- </option> </select> </p> </body> </html> <html> <head> <script> var dragappured = falsevar minrestore = 0 // 该变量表示窗口目前的状态 , 0 表示初始化状态 , 1 表示最大化状态 var initialwidth, initialHeight // 若 клиент 浏览器为 IE5.0 以上版本的 var ie5 = document.all && documentbyd // 若 client 浏览器为 netscape6。0 版本以上的 var var var var var var ns var nts.etmelemid // 若 netscape6。0 版本以上的 var var var ethintmentbyid // 若. 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 = tempy+event.clienty-offsety+"px"} иначе if (NS6 && DragApproved) {document.getElementById ("Dwindow"). style.left = tempx+e.clientx-offsetx+"px" document.getElementById ("Dwindow"). Style.top = tempy+e.clienty-offsety+"px"}} функция инициализирована (e) {offset = ie5? Event.Clientx: e.clientxoffsety = IE5? Event.Clienty: e.clientyDocument.getElementById ("DwindowContent"). Style.display = "Нет" // 此句代码可不要 tempx = parseint (document.getElementbyId ("Dwindow"). Style.left) tempy = parseint (document.getElementbyId ("Dwindow"). Style.top) dragAppuded = trueDocument.getElementbyId ("dwindow"). OnMouseMove = Drag_DROP} function wiledWindow (widthSh -width) (! IE5 &&! NS6) // 若不为 IE 或 netscpae 浏览器 , 则使用一般的 window.open 进行弹出窗口处理 //window.open(url,"","width=width, height=height,scrollbars = 1 ") {} else {document.getElementById (" Dwindow "). Style.display = ''; document.getElementById (" Dwindow "). Style. width = initialwidth = width+"px"; document.getElementById ("Dwindow"). Style.Height = initialHeight = 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}} Функция максимиза () {if (minrestore == 0) {minrestore = 1 // maximize () {if minrestore == 0) {minrestor 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 // Restore windowdocument.getElementbyId ("maxName"). setAttribute ("src", "layout.png") document.getElementById ("Dwindow"). Style.width = in itialwidthdocument.getElementById ("Dwindow"). Style.Height = initialHeight} document.getElementById ("Dwindow"). Style.left = ns6? window.pagexoffset+"px": iecompattest (). Scrollleft+"px" Document.getElementById ("Dwindow"). Style.top = ns6? window.pageyoffset+"px": iecompattest (). scrolltop+"px"} funct stopdrag () {DragAppuded = false; document.getElementById ("Dwindow"). onmouseMove = null; document.getElementByid ("DwindowContent"). Style.display = "// Extra} </script> </head> <body> <div id =" dwindow " style = "позиция: абсолютно; фоновый цвет: #ebebeb; coursor: hand; слева: 0px; top: 0px; display: none" onmousedown = "initizedrag (event)" onmouseup = "stopdrag ()" onselectstart = "return false"> <div Align = "right" style = "founal-color: navy"> <img src = "wylign =" right "style" id = "maxname" onclick = "maximize ()"> <img src = "icon_delete.gif" onclick = "bellowit ()"> </div> <div id = "dwindowContent" style = "Высот: 100%"> </div> </div> <inpute = "value =" 弹出窗口 " onclick = 'LoadWindow (300,200);'> </body> </html>以上这篇 JS 弹出对话框 (遮罩) 透明, 可拖动的简单实例就是小编分享给大家的全部内容了 , 希望能给大家一个参考 , 也希望大家多多支持武林网。