Jquery-IE中的问题
我已经通过下载jquery1.2.3.js的未压缩版本解决了这个问题。我查找导致错误的线路。那是1061年。代码是Jquery-IE中的问题,jquery,Jquery,我已经通过下载jquery1.2.3.js的未压缩版本解决了这个问题。我查找导致错误的线路。那是1061年。代码是 if(set) elem[name] = value; return elem[name]; 为了让jquery在IE中工作,我不得不删除这段代码。这是一个主要问题。我不确定缺少这段代码是否会引起反响。请给我一些建议 以下jquery代码在Firefox中运行良好,但在IE中抛出错误。请有人帮忙。有什么建议吗 错误状态为 Invlalid Argument jquery1.3.2
if(set)
elem[name] = value;
return elem[name];
为了让jquery在IE中工作,我不得不删除这段代码。这是一个主要问题。我不确定缺少这段代码是否会引起反响。请给我一些建议
以下jquery代码在Firefox中运行良好,但在IE中抛出错误。请有人帮忙。有什么建议吗
错误状态为
Invlalid Argument
jquery1.3.2.js Line 12
Code:0 Char: 12949
当我删除内联函数mylib.showreel.init()时代码>错误消失,因此实际错误是由以下代码而不是jquery引起的
showreel :
{
init : function() {
$('#showreel-content').hide();
$('#showreel').addClass('loading');
$.ajax({
type: "GET",
url: "/xml/showreel.xml",
dataType: "xml",
success: function(xml) {
var total = $(xml).find('site').length;
var randnum = Math.floor(Math.random()*total);
$(xml).find('site').each(function(entryIndex, entry) {
if(entryIndex === randnum){
var title = $(this).find('title').text();
var color = $(this).find('color').text();
var url = $(this).find('url').text();
var website = $(this).find('website').text();
var image = $(this).find('image_src').text();
$('#head-contact,#head-contact a').css('color',color);
$('body.home #nav li#home').css('border-bottom','1px solid' + color);
$('<div id="info"></div>')
.html('<div class="entry" style="color:' + color + '">' + title + '<a href="'+url+'"><br />'+website+'</a></div>')
.appendTo('#header-content');
//create new image object to preload image
var img = new Image();
//once image has loaded execute this code
$(img).load(function () {
//$(this).css('display', 'none'); // .hide() doesn't work in Safari when the element isn't on the DOM already
$(this).hide();
$('#showreel').removeClass('loading').append(this);
$(this).fadeIn('slow');
}).error(function () {
// notify the user that the image could not be loaded
}).attr('src', image);
}
});
}//end success function
});//end ajax function
}//end init
}//end showreel
showleel:
{
init:function(){
$(“#显示卷轴内容”).hide();
$('#showreel').addClass('加载');
$.ajax({
键入:“获取”,
url:“/xml/showreel.xml”,
数据类型:“xml”,
成功:函数(xml){
var total=$(xml).find('site').length;
var randnum=Math.floor(Math.random()*总计);
$(xml).find('site').each(函数(entryIndex,条目){
如果(entryIndex==randnum){
var title=$(this.find('title').text();
var color=$(this.find('color').text();
var url=$(this.find('url').text();
var website=$(this.find('website').text();
var image=$(this).find('image_src').text();
$(“#头接触,#头接触a”).css('color',color);
$('body.home#nav li#home').css('border-bottom','1px solid'+color);
$('')
.html(“”+标题+“”)
.appendTo(“#标题内容”);
//创建新图像对象以预加载图像
var img=新图像();
//一旦图像加载完毕,执行此代码
$(img).加载(函数(){
//$(this).css('display','none');//.hide()在Safari中不起作用,因为元素不在DOM中
$(this.hide();
$('#showreel').removeClass('loading').append(this);
$(this.fadeIn('slow');
}).错误(函数(){
//通知用户无法加载映像
}).attr('src',图像);
}
});
}//结束成功函数
});//结束ajax函数
}//结束初始化
}//端部显示卷轴
解决了问题。实际上是这行代码
$('body.home #nav li#home').css('border-bottom','1px solid' + color);
我只是在solid后面加了一个空格。解决这个问题非常简单,但非常耗时。哈哈
$('body.home #nav li#home').css('border-bottom','1px solid ' + color);
请尝试在jquery 1.3.2非精简版上使用此代码。。。在第1061/1051行附近,替换此代码:
if ( set )
elem[ name ] = value;
return elem[ name ];
} to:
var FixedValue = "" + value;
if (FixedValue.length >= 3 && FixedValue.substr(0,3) == "NaN") { value = ""; }
if ( value != undefined )
elem[ name ] = value;
return elem[ name ];
},