js弹出对话框(遮罩)透明、可拖动的简单实例
<html><head><script>function sAlert(txt){//var eSrc=(document.all)?window.event.srcElement:arguments[1];var shield = document.createElement("DIV");shield.id = "shield";shield.style.position = "absolute";shield.style.left = "0px";shield.style.top = "0px"; shield.style.width = "100%"; // window.alert(document.body.scrollheight); shield.style.height = document.body.scrollheight+"px"; shield.style.background = "white"; shield.style.textalign = "" "10000"; shield.style.filter = "alpha(ofacity = 80)"; shield.style.opacity = 0.8; // shield.style.border-width = fick; sthistml = "<input =/" button =/"确确/" id =/"do_ok/" onclick =/"/" />/n"; shield.innerhtml = strhtml; document.body.appendchild(shield); this.dook = function(){document.body.body.removechild(shield);} document.getElementByid( "do_ok")。フォーカス();} </script> < value =登陆> <p align = center> <select> <option> --- </option> </select> </p> </body> </html> <html> <head> <script> var dragapproved = falsevar minrestore = 0 // iecompattest(){return(!window.opera && document.compatmode && document.compatmode!= "backcompat")? document.documentlement:document.body} function drag_drop(e){if (IE5 && DragApproved && Event.button == 1){document.getElementById( "dydow")。style.left= tempx+event.clientx-offsetx+"px" document.getElementbyid( "dodow")。style.top = tempy+event.clienty+"px"} (ns6 && dragapproved){document.getElementById( "dydow")。left.left = tempx+e.clientx-offsetx+"px" document.getelementbyid( "dydow")。stop= tempy+e.clienty-offsety+"px"}}}機能初期化{e){e){e){e){e) event.clientx:e.clientxoffsety = ie5? event.Clienty:E.ClientyDocument.getElementById( "DydowContent")。style.display = "none" // tempx = parseint(document.getElementbyId( "dydow")。style.left)tempy = parseint(document.getElementbyid( "dydow")。style.top)drawapproved = truedocument.getElementbyid( "dwindow") (!ie5 &&!ns6) // ie或netscpae浏览器、则使用一般的window.open = 1 "){} else {document.getElementById(" dydow ")。style.display= ''; document.getElementById(" dydow ")。スタイル。 width = initialwidth = width+"px"; document.getElementbyid( "dydow")。style.height = height = height+"px"; document.getElementById( "dydow")。left = "300px"; document.getElementbyid( "ddy")。 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( "dydow")。style.width = ns6? window.innerwidth-20+"px":iecompattest()。clientWidth+"px" document.getElementById( "dydow")。style.height= ns6? window.innerheight-20+"px":iecompattest()。clientheight+"px"} else {minrestore = 0 // restore windowdocument.getElementById( "maxname")。setAttribute( "src"、 "layout.png")document.getElementById( "dydow")。style.width = initialwidthddocument.getElementbyid( "dwindow")。style.height= neighid} documentbyid(stylement( "docutelementbyid)。 window.pagexoffset+"px":iecompattest()。scrollleft+"px" document.getElementbyid( "dydow")。style.top = ns6? window.pageyoffset+"px":iecompattest()。scrolltop+"px"} function closeit(){document.getElementById( "dyindow")。style.display = "none"} function stopdrag(){dragapproved = false; document.getElementbyId( "dydow")。onmousemove = null; document.getElementById( "dydowContent")。style.display = "" // extra} style = "position:absolute; background-color:#ebebeb; cursor:hand; hand; left:0px; top:0px; display:none" onmousedown = "intializedrag(event)" onmouseup = "stopdrag()" onselectstart = "return fals"> <ディビジョン= "right" stylor id = "maxname" onclick = "maximize()"> <img src = "icon_delete.gif" onclick = "closeit()"> </div> <div id = "ddowcontent" style = "height:100%"> </div> </div> <入力タイプ= "ボタンonclick = 'loadwindow(300,200);'> </body> </html>以上这篇js弹出对话框(遮罩)透明、可拖动的简单实例就是小编分享给大家的全部内容了、希望能给大家一个参考、也希望大家多多支持武林网。