2012-02-21 61 views
0

对不起,如果这篇文章看起来很懒,但我真的不知道下面的代码片断是如何打破我的网站的Javascript!Internet Explorer兼容性被这个javascript/jquery片断打破

$(document).ready(function(){ 
$('a').click(function(){ 
    $(this).blur(); 
}); 
$('.opcion').hover(function() { 
    $(this).css('color','#FFF'); 
},function(){ 
    $(this).css('color','rgb(200,200,200)'); 
}); 
$('body ul li').each(function(){ 
    var tamcompleto = $(this).height() + 'px'; 
    $(this).hover(
     function(){ 
      $(this).stop().animate({height:tamcompleto},{queue:false, duration:600, easing: 'easeOutBounce'}); 
     }, 
     function(){ 
      $(this).stop().animate({height:'50px'},{queue:false, duration:600, easing: 'easeOutBounce'}); 
     } 
    ); 
    $(this).css('height','50px'); 
}); 
$('.comunicate').each(function(){ 
    $(this).click(function(){ 
     var center = 'height=436,width=465,top='+((screen.height - 436)/2)+',left='+((screen.width - 465)/2); 
     var address = 'comunicate.php?fid='+$(this).attr('id'); 
     window.open (address,'comunicate', center); 
    }); 
}); 
$('.objeto').each(function(){ 
    $(this).click(function() { 
     var center = 'height=380,width=900,top='+((screen.height - 380)/2)+',left='+((screen.width - 900)/2); 
     var address = $(this).attr('id'); 
     window.open (address,'Verarticulo', center); 
    }); 
    $(this).hover(function() { 
     $(this).css('backgroundColor','rgb(255,122,79)'); 
    },function() { 
     $(this).css('backgroundColor','rgb(200,200,200)'); 
    }); 
}); 
$('.elastica img').each(function(){ 
    $(this).css('width','100px'); 
    $(this).hover(function(){ 
     $(this).stop().animate({width: 200}, 150); 
    },function(){ 
     $(this).stop().animate({width: 100}, 150); 
    }); 
}); 
$('.elastica').click(function(){ 
    $('#imgampliada').attr('src', $(this).find('img').attr('src')); 
}); 
$('.icon').hover(function(){ 
    var newwidth = $(this).attr('data-width'); 
    $(this).find('img').mousemove(function(e){ 
     var newposition = e.pageX - newwidth/2; 
     $('#choice').html($(this).attr('id')); 
     $('#choice').stop(false, true).animate({width: newwidth, left: newposition}, 200); 
    }) 
}); 
$('#iconwrapper').mouseout(function(){ 
    $('#choice').html(''); 
    $('#choice').stop(false, true).animate({width: 0}, 100); 
}); 
}); 

function popup(mylink, windowname) 
{ 
if (! window.focus)return true; 
var href; 
if (typeof(mylink) == 'string') 
    href=mylink; 
else 
    href=mylink.href; 
window.open(href, windowname, 'width=400,height=200,scrollbars=yes'); 
return false; 
} 

有没有人在IE浏览器兼容性方面有更多的经验,对于javascript有什么想法是什么错误?该页面在FF和Chrome中完美运行;但不会在IE中加载任何JavaScript。这真让我抓狂!!

+1

_“但不在IE中加载任何javascript”_ - 你是什么意思“不加载”?不运行?我没有看到任何明显的问题,所以如果出于某种原因你不能使用IE的调试工具,那么你可以通过采取旧的忠实方法删除/评论一次(比如说一个' .each()'一次),直到它开始工作。 – nnnnnn 2012-02-21 11:33:59

+0

你有什么错误吗?一些更多的信息,究竟如何不工作将有助于.. – Jon 2012-02-21 11:44:15

+0

控制台中的任何错误? (尝试在IE中打F12) – 2012-02-21 12:12:07

回答

0

请再仔细检查一下,您所传递给popup()的值是否为windowname没有空格。当window.open()使用空格时,IE不喜欢它。

相关问题