IE8兼容模式下的javascript错误 [英] javascript error in IE8 compatibitlity mode
问题描述
我有以下jQuery代码在IE8,FF中正常工作,但在IE8补偿模式下会出现此错误
I have the following jQuery code that works fine in IE8, FF but in IE8 comp mode it gives this error
网页错误详细信息
用户代理:Mozilla/4.0(兼容; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152 ; .NET CLR 3.5.30729; Creative AutoUpdate v1.30.00) 时间戳记:2010年10月29日,星期五,UTC时间
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Creative AutoUpdate v1.30.00) Timestamp: Fri, 29 Oct 2010 22:12:03 UTC
消息:对象不支持此属性或方法 线:162 字符:44 代码:0
Message: Object doesn't support this property or method Line: 162 Char: 44 Code: 0
这是第162行
$(this).attr('onChange', function(iii,vvv){return vvv.replace('_','');});
这是完整的脚本
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$("select[name^=SELECT___]").each(function(){
$(this).attr('onChange', function(iii,vvv){return vvv.replace('_','');});
});
$("a[href^='javascript:change_option']").each(function(){
$(this).attr('href', function(ii,vv){return vv.replace('_','');});
});
});
</script>
是什么导致此错误?还有另一种方法可以做我想做的事吗?
What is causing this error? Is there another way to do what I want to do?
我需要做的是在页面上以下代码的每个实例中,将"change_option"更改为"changeoption",也许有一种更好的方法.
What I need to do is change the "change_option" to "changeoption" in each instance of the following code on the page, Perhaps there is a better way of doing it.
这是HTML代码.我无权访问此html代码
Here is the HTML code. I do not have access to this html code
<select onChange="change_option('SELECT___100E___7',this.options[this.selectedIndex].value)" name="SELECT___100E___7">
这是doc声明.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
推荐答案
我需要做的就是改变 从"change_option"到"changeoption" 以下代码的每个实例 页面上,也许有更好的 的方式.
What I need to do is change the "change_option" to "changeoption" in each instance of the following code on the page, Perhaps there is a better way of doing it.
也许.为什么不能仅创建changeoption的别名(假设您已定义函数)?
Perhaps. Why can't you just create an alias of changeoption (assuming you have defined the function)?
var change_option = changeoption;
这篇关于IE8兼容模式下的javascript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!