IE FF OPERA都可用的弹出层实现代码

(编辑:jimmy 日期: 2024/10/10 浏览:2)

复制代码 代码如下:
// JavaScript Document
var dv;
var dvMsg;
function customalert()
{

dvMsg = document.createElement("div");
dvMsg.style.position = "absolute";
dvMsg.setAttribute('id', 'msg');
dvMsg.style.width = "600px";
dvMsg.style.padding = "10 0 2 0";
dvMsg.style.height = "313px";
dvMsg.style.background = "#EF621D";
dvMsg.style.border = "1px solid #6699dd";
dvMsg.style.zIndex = "1112";
document.body.appendChild(dvMsg);
document.getElementById("msg").style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight - document.getElementById("msg").offsetHeight)/2 + "px";
document.getElementById("msg").style.left = document.documentElement.scrollLeft + (document.documentElement.clientWidth - document.getElementById("msg").offsetWidth)/2 + "px";
var imgs = document.createElement("div");
imgs.setAttribute("id", "pic");
imgs.title = "close";
imgs.style.float = "left";
imgs.style.height = "20px";
imgs.innerHTML = "<a href=\"https://www.jb51.net\" target=\"_blank\"><img src=\"../javascript/close.gif\"/></a>";
imgs.style.color = "#FFF";
imgs.style.textAlign = "right";
imgs.style.cursor = "pointer";
imgs.style.zIndex = "1114";
imgs.onclick = function()
{
document.body.removeChild(dvMsg);
document.body.removeChild(dv);
}

document.getElementById("msg").appendChild(imgs);
var divstr = document.createElement("div");
divstr.setAttribute("id", "info");
divstr.style.left = "0";
divstr.style.position = "absolute";
divstr.style.marginTop = "10px";
divstr.style.zIndex = "1115";
divstr.innerHTML = "<embed src=\"gallery/header2.swf\" pluginspage=\"http://www.macromedia.com/shockwave/download /\" width=\"600\" height=\"313\"></embed>";
document.getElementById("msg").appendChild(divstr);
}

function scrolldivs()
{
document.getElementById("msg").style.top=document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("msg").offsetHeight)/2+"px";
document.getElementById("msg").style.left=document.documentElement.scrollLeft+(document.documentElement.clientWidth-document.getElementById("msg").offsetWidth)/2+"px";
}

window.attachEvent("onresize",scrolldivs);
window.onscroll=scrolldivs;
window.onload=scrolldivs;
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。