2011-06-24 36 views
1

我的導航的特定位工作是不是在IE7或IE8工作現場www.garden-design-courses.co.ukJavaScript的.load功能不是編碼

我通過拉文件導航使用:

function loadTopmenu() 
{ 
    $("#topmenu").load("http://www.garden-design-courses.co.uk/lib/topmenu.html"); 
    } 

我用這頁腳和頁眉和正常工作,這使我公司由於相信該文件中的JavaScript:

$(document).ready(function(){ 

    $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav 
    $("ul.subnav2").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav 

    $("ul.topnav li span").click(function() { //When trigger is clicked... 

     //Following events are applied to the subnav itself (moving subnav up and down) 
     $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click 

     $(this).parent().hover(function() { 
     }, function(){ 
      $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up 
     }); 

     //Following events are applied to the trigger (Hover events for the trigger) 
     }).hover(function() { 
      $(this).addClass("subhover"); //On hover over, add class "subhover" 
     }, function(){ //On Hover Out 
      $(this).removeClass("subhover"); //On hover out, remove class "subhover" 
    }); 


    $("a.dip").click(function() { //When trigger is clicked... 

     //Following events are applied to the subnav itself (moving subnav up and down) 
     $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click 

     $(this).parent().hover(function() { 
     }, function(){ 
      $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up 
     }); 

     //Following events are applied to the trigger (Hover events for the trigger) 
     }).hover(function() { 
      $(this).addClass("subhover"); //On hover over, add class "subhover" 
     }, function(){ //On Hover Out 
      $(this).removeClass("subhover"); //On hover out, remove class "subhover" 
    }); 

    $("a.dip2").click(function() { //When trigger is clicked... 

     //Following events are applied to the subnav itself (moving subnav up and down) 
     $(this).parent().find("ul.subnav2").slideDown('fast').show(); //Drop down the subnav on click 

     $(this).parent().hover(function() { 
     }, function(){ 
      $(this).parent().find("ul.subnav2").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up 
     }); 

     //Following events are applied to the trigger (Hover events for the trigger) 
     }).hover(function() { 
      $(this).addClass("subhover"); //On hover over, add class "subhover" 
     }, function(){ //On Hover Out 
      $(this).removeClass("subhover"); //On hover out, remove class "subhover" 
    }); 

}); 

任何想法?

+0

嘗試從url中刪除http://www.garden-design-courses.co.uk,這可能是該問題。但可能wouldnt – genesis

+0

謝謝,但那沒有做任何事情 – meohmy

回答

0

將其更改爲:

$("#topmenu").load("http://www.garden-design-courses.co.uk/lib/topmenu.html", function (a,b,c) {console.log(a,b,c);}); 

並檢查它是否給你一個錯誤,而不是你的控制檯上預期的內容。