2011-02-07 47 views
0

好吧,我得到這個代碼:JQuery問題 - 不工作!

<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
     <script type="text/javascript" href="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> 
     <title>JQuery Demo 1</title> 
     <style type="text/css"> 
      #box 
      { 
       background-color: #ff0000; 
      } 
     </style> 
     <script type="text/javascript"> 
      $(function(){ 
       $('a').click(function() 
       { 
        $('#box').fadeOut(); 
       }); 
      }); 
     </script> 
    </head> 
    <body> 
     <div id="box">Yes!</div> 
     <a href="#">Click me!</a> 
    </body> 
</html> 

我從視頻教程系列這兒以下這一點。這是該系列中的第一個。 (http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-video-series/)

當我執行此,螢火蟲說錯誤

$沒有定義[中斷在此錯誤] $(函數(){

在嘖嘖,它工作正常。任何幫助,不勝感激。

回答

0

變化

<script type="text/javascript" href="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> 

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> 
3

更改HREF爲src在您的jQuery腳本標籤(4號線)...

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> 
+0

的感謝!嘖嘖。編碼真的很糟糕。 :( – Hirvesh 2011-02-07 13:32:30