博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java 弹出窗口在屏幕中心_屏幕上的弹出式窗口中央?
阅读量:7029 次
发布时间:2019-06-28

本文共 1197 字,大约阅读时间需要 3 分钟。

0a89f97ce45bf9f36163a305a1c23edc.png

墨色风雨

单/双监控功能(贷记于http://www.xtf.dk-谢谢!)更新:由于@Frost,它还能在不超过屏幕宽度和高度的窗口上工作!如果你在双显示器上,窗口会水平地集中,但不是垂直的.使用此函数对此进行解释。function PopupCenter(url, title, w, h) {

    // Fixes dual-screen position                         Most browsers      Firefox

    var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX;

    var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY;

    var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth :

     screen.width;

    var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : 

    screen.height;

    var systemZoom = width / window.screen.availWidth;var left = (width - w) / 2 / systemZoom + dualScreenLeftvar top = (height - h) / 2 /

     systemZoom + dualScreenTop    var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w / systemZoom + ', height=' + 

     h / systemZoom + ', top=' + top + ', left=' + left);

    // Puts focus on the newWindow

    if (window.focus) newWindow.focus();}用法示例:PopupCenter('http://www.xtf.dk','xtf','900','500');贷记如下:http:/www.xtf.dk/2011/08/Center-新-弹出窗口-偶-on.html(我只想链接到这个页面,但万一这个网站掉了,代码就在这里了,干杯!)

转载地址:http://ehexl.baihongyu.com/

你可能感兴趣的文章
MVVM模式下弹出窗体
查看>>
URAL 1018 Binary Apple Tree
查看>>
MYSQL中char 与 varchar 的区别
查看>>
算法设计与分析基础 (Anany Levitin 著)
查看>>
BackBone 源码解读及思考
查看>>
Mybatis四种分页方式
查看>>
查找-二分法查找(折半查找法)
查看>>
svn is already locked解决方案
查看>>
Oracle合并某一列
查看>>
C语言结构体知识
查看>>
centos安装ftp
查看>>
Viewpager+fragment数据更新问题解析
查看>>
多线程实现socketserver练习
查看>>
ElasticSearch 模板文件配置
查看>>
leetcode–Binary Tree Maximum Path Sum
查看>>
字节对齐总结
查看>>
[LeetCode]22. Generate Parentheses括号生成
查看>>
idea tomcat 乱码问题的解决及相关设置
查看>>
centos7 yum搭建lamp
查看>>
Oracle 热备份
查看>>