简体   繁体   English

该脚本在IE中不起作用。 我该如何解决?

[英]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>&nbsp;</td><td id=t3>&nbsp;</td><td id=t2>&nbsp;</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开始支持。

Replacement 替代

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 我看到其他一些问题

  • All of your attribute values should be in quotes. 您的所有属性值都应用引号引起来。 for example. 例如。 id="value"
  • you have LEFT spelled 1(number 1)eft 您已将LEFT拼写为1(数字1)eft

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用$ .getJSON(),我无法在任何版本的IE中接收结果。 Firefox / Chrome正常运行 - Using $.getJSON() I can't receive results in any version of IE. Firefox/Chrome work ok 锚标记中的Javascript在FireFox和IE中不起作用。 可以在Chrome浏览器中使用 - Javascript in anchor tag not working in FireFox and IE. Does work in Chrome 本地存储和IE。 无法使其工作 - Local Storage and IE. Can't make it work 我怎样才能让这个滑块在一定的延迟下自动循环? IE。 1000ms - How can I make this slider loop automatically with a certain delay? ie. 1000ms 如何在单轴上(例如,对于特定旋转)在水平或垂直轴上制作图像动画 - How can I make animation of image in a single axis ie., for a particular rotation - on horizontal or vertical axis EXT拖放事件发生冲突-即 如何同时使用ondragout和notifyout? - EXT drag and drop events clash - ie. how can I use both ondragout and notifyout at the same time? 过滤时分页不起作用。 我该如何解决? - Pagination does not work when filtering. How can i fix? 如何判断Google的Streetview Image API是否返回“抱歉,我们这里没有图像”(即NULL)结果? - How can I tell if Google's Streetview Image API Returns “Sorry, we have no imagery here” (ie. NULL) Result? MultiSelect:预期的对象。 jQuery在IE中不起作用。 在Firefox中效果很好 - MultiSelect : Object expected. Jquery does not work in IE. Works well in Firefox 是否有任何javascript / jquery插件可以帮助拖放多个文件,并且可以在至少FF和IE中工作。 - Is there any javascript/jquery plugin that can help to drag and drop multiple files, and work in atleast FF and IE.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM