本文实例讲述了JS关闭窗口时产生的事件及用法。分享给大家供大家参考,具体如下:
(cltHeight/2)){
newbox.style.marginTop = ( - (cltHeight/2)) + "px";
}else{
newbox.style.marginTop = ( - height/2) + "px";
}
if(width/2 > (pageWidth/2)){
newbox.style.marginLeft = ( - (pageWidth/2)) + "px";
}else{
newbox.style.marginLeft = ( - width/2) + "px";
}
return "您尚未对客服服务作出评价,请点击‘取消'评分!";
};
function mydiv_resize(){
var pageWidth = Math.max(window.top.document.body.scrollWidth,window.top.document.documentElement.clientHeight);
var cltWidth = Math.max(window.top.document.body.clientWidth,window.top.document.documentElement.clientWidth);
var width = 400 ;
var height = 200 ;
var layer = window.top.document.getElementById("zz_layer");
if (layer != null) {
// 遮罩层
layer.style.width = pageWidth + "px";
layer.style.height = pageHeight + "px";
}
// 评价窗口
var newbox = document.getElementById("KF_PJ_DIV");
newbox.style.left = cltWidth/2 + "px";
newbox.style.top = (cltHeight/2) + "px";
if(height/2 > (cltHeight/2)){
newbox.style.marginTop = ( - (cltHeight/2)) + "px";
}else{
newbox.style.marginTop = ( - height/2) + "px";
}
if(width/2 > (pageWidth/2)){
newbox.style.marginLeft = ( - (pageWidth/2)) + "px";
}else{
newbox.style.marginLeft = ( - width/2) + "px";
}
}
window.onresize = mydiv_resize;
更多关于JavaScript相关内容感兴趣的读者可查看本站专题:《》、《》、《》、《》、《》、《》、《》、《》及《》
希望本文所述对大家JavaScript程序设计有所帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。