<!DOCTYPE html>

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Line</title> <script type="text/javascript">
window.onload = function () {
document.getElementById("btnZX").onclick = function () {
var locator = new ActiveXObject("WbemScripting.SWbemLocator");
var service = locator.ConnectServer("."); //显示器
var xsq = new Enumerator(service.ExecQuery("select * from Win32_DesktopMonitor")); //得到所有显示器的分辨率
//如果有2个显示器,则有2对分辨率;反之,则为1个显示器
var xsq1Width;
var xsq1Height;
var xsq2Width;
var xsq2Height;
var i = 1; for (; !xsq.atEnd() ; xsq.moveNext()) {
if (i == 1) {
xsq1Width = xsq.item().ScreenWidth;
xsq1Height = xsq.item().ScreenHeight;
} else if (i == 2) {
xsq2Width = xsq.item().ScreenWidth;
xsq2Height = xsq.item().ScreenHeight;
}
i++;
} //判断单双屏
if ((xsq1Width == null && xsq1Height == null) || (xsq2Width == null && xsq2Height == null)) {
window.open("", "", "top=0,left=0,alwaysRaised=no,fullscreen=yes");
}
else {
//显示器1是主屏
if (window.screen.width == xsq1Width && window.screen.height == xsq1Height) {
if (window.screenLeft >= 0 && window.screenLeft < xsq1Width) {
window.open("", "", "top=0,left=" + xsq1Width + ",width=" + (xsq2Width - 20) + ",height=" + xsq2Height + "");
}
if (window.screenLeft >= xsq1Width && window.screenLeft < (xsq1Width + xsq2Width)) {
//从右向左跳
window.open("", "", "top=0,left=0,width=" + (xsq1Width - 20) + ",height=" + xsq1Height + "");
}
} //显示器2是主屏
if (window.screen.width == xsq2Width && window.screen.height == xsq2Height) {
//alert("显示器2是主屏"); if (window.screenLeft >= 0 && window.screenLeft < xsq2Width) { window.open("", "", "top=0,left=0,width=" + (xsq1Width - 20) + ",height=" + xsq1Height + "");
}
if (window.screenLeft >= (-xsq1Width) && window.screenLeft < 0) {
//从左向右跳 var objWin = window.open("", "", "top=0,left=0,width=" + (xsq2Width - 20) + ",height=" + xsq2Height + "");
}
}
} } } </script> </head>
<body>
<div>
<button type="button" id="btnZX">专线</button>
</div>
</body>
</html>

最新文章

  1. Linux2 在Linux(CentOS)上配置SSH免登陆
  2. 【CityHunter】Unity3D设计AR探索模式
  3. 安卓学习-- RecyclerView简单入门
  4. Markdown中的缩进
  5. 破解 abexcrackme2
  6. phpstorm10.0.1和webstorm11注册
  7. 【35】考虑virtual方法以外的其他选择
  8. html阶段测试
  9. Android 7.0 中 ContentProvider 实现原理
  10. TCP为何采用三次握手来建立连接,若采用二次握手可以吗
  11. ajax跨域请求问题及解决办法总结
  12. One take,可望而不可即
  13. NOIP2015斗地主(搜索+模拟+贪心)
  14. CSS选择器、样式、盒模型
  15. 用ab的post方式进行测试
  16. 实战ELK(3) Kibana安装与简单实用
  17. 二十一、proxyDesign 代理模式
  18. oracle学习笔记1(环境搭建)
  19. 在centos上搭建Git服务器
  20. Objective-C 中的协议(@protocol)和接口(@interface)的区别

热门文章

  1. 利用JqGrid结合ashx及EF分页显示列表之二
  2. Entity Framework Code First关系映射约定【l转发】
  3. mac下的git的安装与简单的配置
  4. 【Excle数据透视】多列分别分类计数
  5. Flume日志收集系统介绍
  6. c#:无法将类型为“System.DBNull”的对象强制转换为类型“System.String”
  7. Python-搭建Nginx+Django环境
  8. Zoie中文文档及简单解析
  9. 公众号的TOKEN配置PHP代码
  10. mysql date and time type ---- mysql 时间&amp;日期 类型详解