2013-04-07 46 views
0

我在页面下面的代码;

$(document).ready(function() { 
    window.setInterval(function(){ 
     $("#customers, td, #span").each(function(){ 
      if($(this).children("span").attr("alt")!=null) 
       var dt=new Date($(this).children("span").attr("alt").split(",")[3]).getTime(); 
        if(dt>$.now()-10*1000){ //am i right here?? 
         console.log("animating"); 
         $(this).parent().fadeOut("slow"); 
         $(this).parent().fadeIn("slow"); 
        }   
     }); 
    },1000); 
}); 

此代码在Chrome浏览器上正常工作,但无法在Firefox上运行; firefox说TypeError: $(...).each is not a function

任何人都可以帮助我?

+0

请把jsbin.com或jsfiddle.net粘贴整个html代码吗?这将有助于理解缺少的东西,但我的猜测是你没有包含对jquery.js的引用 – ararog 2013-04-07 11:07:17

+1

难道你有*另一个* JS框架加载除了jQuery?当你用'jQuery'替换所有'$'时它会工作吗? – Tomalak 2013-04-07 11:10:44

+0

http://jsbin.com/ekibet/1/edit – 2013-04-07 11:48:08

回答

0

它看起来像new Date()不工作在Firefox。

日期是;

new Date("2013-04-07 15:39:17"); 

我更新到;

new Date("2013/04/07 15:39:17");