JS关闭窗口时产生的事件及用法示例

本文实例讲述了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程序设计有所帮助。

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...