本文实例讲述了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程序设计有所帮助。
原文链接:https://www.f2er.com/js/46427.html