[英]The script does not work in IE. How can I fix it?
There is a script that changes the page template depending on the user's monitor screen resolution. 有一个脚本可以根据用户的监视器屏幕分辨率更改页面模板。 However, it does not work in IE.
但是,它在IE中不起作用。 Advise how to fix it, please.
请建议如何修复它。
<body>
<table id="mt" align="center" >
<tr>
<td colspan=3 id=top>{{head}}</td></tr><tr><td id=t1> </td><td id=t3> </td><td id=t2> </td></tr><tr>
<td id=1eft valign=top>{{left}}</td>
<td id=content><h1>[*pagetitle*]</h1>[*content*]</td>
<td id=right>{{right}}</td></tr>
<tr><td id=ft colspan=3>{{foot}}</td></tr>
</table><script>if (window.outerWidth>1440) {a='1440px';} else {a='auto';}document.getElementById("mt").style.width = a;</script></body>
outerWidth
is supported by IE, but since from the IE9. IE支持
outerWidth
,但从IE9开始支持。
Not all browsers have the window.outerWidth and window.outerHeight properties. 并非所有浏览器都具有window.outerWidth和window.outerHeight属性。 Geek Daily has a good post on cross-browser window size detection .
Geek Daily在跨浏览器窗口大小检测方面有不错的文章。 I'd suggest looking there.
我建议去那里。 As an example, here's what I get in each browser on a desktop with 1280x1024 resolution.
例如,这是我在分辨率为1280x1024的台式机上使用的每个浏览器的功能。
Chrome 铬
window.outerWidth
1288
document.body.offsetWidth
1264
document.documentElement.offsetWidth
1280
Firefox 火狐
window.outerWidth
1288
document.body.offsetWidth
1238
document.documentElement.offsetWidth
1264
IE7 Doctype Defined IE7 Doctype已定义
window.outerWidth
undefined
document.body.offsetWidth
1260
document.documentElement.offsetWidth
1260
IE7 No Doctype/Quirks Mode IE7否Doctype / Quirks模式
window.outerWidth
undefined
document.body.offsetWidth
1260
document.documentElement.offsetWidth
1280
I see a few other problems 我看到其他一些问题
id="value"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.