简体   繁体   English

IE6脚本标签错误

[英]IE6 Script Tag error

I've never seen this error. 我从未见过此错误。 We have some clients that use Internet Explorer 6, so we need some pages to work on it. 我们有一些使用Internet Explorer 6的客户端,因此我们需要一些页面才能使用它。

We have the following HTML code: 我们有以下HTML代码:

<script type="text/javascript">
var bust = 236;
</script>

IE6 is throwing the following error message: 'Undefined' is null or not an object . IE6抛出以下错误消息: 'Undefined' is null or not an object

Do you have any idea what it might be? 你知道这可能是什么吗? Thanks. 谢谢。

It sounds like bust is conflicting with some other global. 听起来像bust与其他全球性组织冲突。 The global name space is really crowded. 全局名称空间确实很拥挤。

You may be able to resolve it by wrapping your code in a scoping function so that it's not at global scope anymore: 您可能可以通过将代码包装在作用域函数中来解决它,从而使其不再处于全局范围内:

<script type="text/javascript">
(function() {
    var bust = 236;
})();
</script>

Or if it has to be a global, try another name until you find one that doesn't cause the problem. 或者,如果是一个全球性的,换个名称,直到你找到一个不会引起问题。 Global variables aren't fundamentally broken, even in IE6. 即使在IE6中,全局变量也没有从根本上被破坏。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM