2010-02-04 51 views
0

我突然對這個page得到一個最不受歡迎的錯誤:jQuery的錯誤 - xyz是不是一個函數

Error: $("#accordion").accordion is not a function

我的jQuery代碼如下:

<script type="text/javascript"> 
     $(function(){ 

      // Accordion 
      $("#accordion").accordion({ header: "h4", autoHeight: false, collapsible: true }); 

      //hover states on the static widgets 
      $('#dialog_link, ul#icons li').hover(
       function() { $(this).addClass('ui-state-hover'); }, 
       function() { $(this).removeClass('ui-state-hover'); } 
      ); 

      // controls the sidebar navigation action    
      $('.interior #subContent > ul > li > a.drop').click(function(){ 
      $(this).parent().children('ul').toggle("slow"); 
       return false; 
      }); 

      $(window).ready(function() { 
       $('li.products ul').show(); 
       $('li.technical ul').show(); 
       $('li.tips ul').show(); 
      }); 

     }); 
    </script> 

我已經好幾個星期工作,今天......錯誤。

我將不勝感激任何幫助確定錯誤的原因。

謝謝。

+0

您是否意外刪除了jquery或jquery UI腳本? – Patricia 2010-02-04 14:59:20

+1

@fmz - 我建議用Firefox的Firebug插件(http://getfirebug.com/)來查看你的網站,你可以使用「Net」標籤,它會顯示你得到了六個404錯誤,所以你確切知道哪個JavaScript文件未被加載。 – 2010-02-04 15:07:30

+0

約翰,我使用螢火蟲,但忽略了網絡功能。謝謝你的提示。 – fmz 2010-02-04 17:14:21

回答

2

發現了問題:

此:

<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.accordion.js"></script> 

不會鏈接到任何東西了。

The requested URL /svn/tags/latest/ui/ui.accordion.js was not found on this server.

+0

你是對的。看起來jquery ui服務器存在問題。我在Google上找到了這個鏈接,並用它取代了上述鏈接:http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js 謝謝。 – fmz 2010-02-04 15:18:38

相關問題