JS与CSS结合实现DIV显示/隐藏透明层
#massage_box{ position:absolute; left:expression((body.clientWidth-massage_box.offsetWidth)/2); top:expression((body.clientHeight-300)/2); width:620px; height:400px;z-index:2; visibility:hidden} #mask{ position:absolute; top:0; left:0; width:expression(body.scrollWidth); height:expression(body.scrollHeight); background:#000000; filter:ALPHA(opacity=65); z-index:1; visibility:hidden; margin:auto} .massage{width:100%; height:100%; color:#036; font-size:12px; line-height:150%}
var Obj=''
document.οnmοuseup=MUp
document.οnmοusemοve=MMove
function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}
function MMove(){
if(Obj!=''){
document.all(Obj).style.left=event.x-pX;
document.all(Obj).style.top=event.y-pY;
}
}
function MUp(){
if(Obj!=''){
document.all(Obj).releaseCapture();
Obj='';
}
}
function sc1(){
document.getElementById("massage_box").style.top=document.body.scrollTop+(document.body.clientHeight-document.getElementById("massage_box").offsetHeight)/2
document.getElementById("massage_box").style.left=document.body.scrollLeft+(document.body.clientWidth-document.getElementById("massage_box").offsetWidth)/2;
}
function scall(){
sc1();
}
window.οnscrοll=scall;
window.οnresize=scall;
window.οnlοad=scall;
![]() |
[关闭] |
[打开] | ||
response.Write("")
next %>
更多相关文章请关注PHP中文网(www.gxlcms.com)!
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉
本文系统来源:php中文网