2012-04-15 217 views
0

我必須開發一個應用程序,它的一部分是IQuery,但我不熟悉它。 在鼠標懸停在地圖上時,代碼必須執行並更改背景顏色的地圖和鏈接顏色。它適用於Chrome和Firefox,但在Inernet Exlporer中無效。 請任何幫助!JQuery不在IE中工作,但在Chrome和Firefox中工作

這裏是我的代碼:

<script type="text/javascript" > 
try{ 
    jQuery(document).ready(function() { 

     $.fn.maphilight.defaults = { 
      fill: true, 
      fillColor: '008000', 
      fillOpacity: 0.8, 
      stroke: false, 
      strokeColor: 'ff0000', 
      strokeOpacity: 1, 
      strokeWidth: 1, 
      fade: true, 
      alwaysOn: false, 
      neverOn: false, 
      groupBy: false 
     }; 
     $(".main-menu").mouseover(function() { 
      alert('go'); 
      var himg = $(this).attr('himg') 
      $(this).children().attr('src', himg) 
     }); 

     $(".main-menu").mouseout(function() { 
      var nimg = $(this).attr('nimg') 
      $(this).children().attr('src', nimg) 
     }); 

     $("a.fancybox").fancybox({ 
      'titlePosition': 'inside' 
     }); 

     $("a.iframe").click(function() { 
      $.fancybox({ 
       'padding': 0, 
       'margin': 0, 
       'autoScale': false, 
       'transitionIn': 'none', 
       'transitionOut': 'none', 
       'width': 980, 
       'height': 575, 
       'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'), 
       'type': 'iframe' 
      }) 
      return false; 
     }); 

     $('#photos').galleryView({ 
      panel_width: 900, 
      panel_height: 300, 
      frame_width: 160, 
      frame_height: 110 
     }); 
     $("#one").sexyCombo({ 
      emptyText: "Select" 
     }); 
     $("#two").sexyCombo({ 
      emptyText: "Select" 
     }); 
     $("#three").sexyCombo({ 
      emptyText: "Select" 
     }); 

    }); 
    } 
catch (err) 
{ 
    alert(err); 
} 
</script> 

回答

1

取出try-catch電話。你似乎並不需要那裏,並導致在IE瀏覽器的進攻。

+0

原始代碼沒有try-catch,我添加了這個捕獲錯誤,但無法捕捉它。因此,我認爲嘗試抓住不是理由。 – Shaahin 2012-04-15 09:24:35

相關問題