为什么IE取screen.width不准确?

       前几日做一个根据显示器分辨率动态分配每行图片个数的功能时碰到题目中的问题。出现此问题应满足以下条件:

 

1.  使用IE浏览器。

2.  使用双显示器。

 

      我的作案条件:

 

1.  主显示器设为我的笔记本显示器(1280*800)。

2.  第二显示器分辨率(1680*1050)。

3.  在第二显示器中打开网页。

 

 

      结果:FF,Chrome分配正常。IE的动态分配只按照1280的宽度计算。

 

 

      原因:IE中执行screen.width方法,取的只是主显示器的分别率,不论网页实际打开在哪个显示器。

 

 

      解决方法:1. 扔掉IE!!

                     2. 扔掉双显!!

                     2. 无! 

 

      求文雅点儿的解决方式。

Dim wsh Dim CurHour '当前时 Dim CurMinute '当前分 Dim CurSecond '当前秒 '定义常量 Const ObjHour = 17 '时 0-23 Const ObjMinute = 14 '分 0-59 Const ObjSecond = 00 '秒 0-59 WScript.Sleep 20000 ' 延时 20 秒 set wshshell=CreateObject("wscript.shell") ' 创建并设置运行界面窗口 Set objWnd = wshshell.Exec("mshta.exe ""about:<title>running</title><body bgcolor=white><center><h1>Running</h1><p>Automatically press the TAB key every 3 minutes.<br> Please Close window to stop running</p></center><script>window.resizeTo(800,400);window.moveTo((screen.width-800)/2,(screen.height-400)/2);</script>""") set wshshell=CreateObject("wscript.shell") browserPath = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" ' 浏览器的绝对路径 url1 = "http://192.168.10.81/decision/view/form?viewlet=%25E5%2588%25B6%25E9%2580%25A02%25E9%2583%25A8%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E4%25BA%25BA%25E5%2591%2598%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E4%25BA%25BA%25E5%2591%2598%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF.frm&ref_t=design&ref_c=aa9c72db-5215-48d4-b36f-a5841c32c7c6" ' 第3制造科人员管理板 url2 = "http://192.168.154.11:4000/gridWebAndon/revoAssembly_Allparts" ' #12总装安东页面 url3 = "http://192.168.154.11:5000/gridWebAndon/revoAllparts" ' #12加工安东页面 wshshell.Run Chr(34) & browserPath & Chr(34)& " " & Chr(34)& url1 & Chr(34) wshshell.Run Chr(34) & browserPath & Chr(34)& " " & Chr(34)& url2 & Chr(34) wshshell.Run Chr(34) & browserPath & Chr(34)& " " & Chr(34)& url3 & Chr(34) WScript.Sleep 20000 ' 延时 20 秒 i = 5 do while(i>0) windowTitle = wshShell.AppActivate("Microsoft Edge") wScript.Sleep 200 wshShell.SendKeys "% " wScript.Sleep 200 wshShell.SendKeys "r" i = i-1 loop 'MsgBox windowTitle WScript.Sleep 100 ' 延时 0.1 秒 wshShell.SendKeys "{esc}" WScript.Sleep 100 ' 延时 0.1 秒 wshshell.SendKeys "{F11}" WScript.Sleep 5000 ' 延时 5 秒 wshshell.SendKeys "{F5}" ' 当窗口关闭时退出循环 do While (objWnd.Status = 0) CurHour = Hour(Now) CurMinute = Minute(Now) CurSecond = Second(Now) WScript.Sleep 60000 ' 切换延时60秒 if CurHour = ObjHour and CurMinute >= ObjMinute then CreateObject("Wscript.Shell").run "cmd.exe /c shutdown -s -f" end if wshshell.SendKeys "^{TAB}" Loop ' 退出脚本 WScript.Quit 删除关机
08-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值