标签:
var draw = function() { // var time = new Date().getTime(); mWindow = lw.create(‘div‘); document.body.appendChild(mWindow); mWindow.style.display = ‘none‘; var windowId = ‘lwWindow_‘ + time; mWindow.setAttribute(‘id‘, windowId); mWindow.setAttribute(‘class‘, ‘lwWindow‘); mWindow.style.width = document.body.scrollWidth + ‘px‘; mWindow.style.height = document.body.scrollHeight + ‘px‘; mDialog = lw.create(‘div‘); document.body.appendChild(mDialog); mDialog.style.display = ‘none‘; var dialogId = ‘lwDialog_‘ + time; mDialog.setAttribute(‘id‘, dialogId); mDialog.setAttribute(‘class‘, ‘lwDialog‘); mDialog.style.width = mWidth + ‘px‘; mDialog.style.height = mHeight + ‘px‘; var pageWidth = Math.min(window.screen.availWidth, document.body.clientWidth); var pageHeight = Math.min(window.screen.availHeight, document.body.clientHeight); var top = document.documentElement.scrollTop - 100 + (pageHeight - mHeight) / 2; var left = document.documentElement.scrollLeft + (pageWidth - mWidth) / 2; if (top < 0) { top = 100; } if (left < 0) { left = 100; } mDialog.style.top = top + ‘px‘; mDialog.style.left = left + ‘px‘; // ... }
.lwWindow { position: absolute; left: 0px; top: 0px; margin: 0; padding: 0; background-color: gainsboro; filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.5; } .lwDialog { position: absolute; overflow: hidden; border: 2px solid lightblue; background-color: white; }
标签:
原文地址:http://www.cnblogs.com/linkwork/p/4190864.html