2012-04-24 108 views
1

我是Jquery的新手,並試圖學習它, 我有以下代碼段,但由於某種原因,我的圖像未加載。 當我通過運行命令運行相同的鏈接時,圖像彈出。 它說無法加載指定的URL,當我調試通螢火HTML導入錯誤

<!DOCTYPE html> 
<html><head> 
    <title>Furry Friends Campaign</title> 
    <link rel="stylesheet" type="text/css" href="c:/jquery/Chapter-1/begin/styles/my_style.css"> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 
    </head> 
    <body> 
    <div id="clickMe">Show Me the Furry Friend of the Day</div> 
    <div id="picframe"> 
    <img src="c:/jquery/chapter-1/begin/images/img_0229.jpg"> 
    </div> 
    <script src="scripts/jquery-1.6.2.min.js"></script> 
    <script> 
     $(document).ready(function(){ 
     $("#clickMe").click(function() { 
     $("img").fadeIn(1000); 
     $("#picframe").slideToggle("slow"); 
    }); 
     }); 
    </script> 
    </body> 
</html> 

回答

0

嘗試「文件:// C:/ jQuery的/第二章-1 /開始/圖片/ img_0229.jpg「作爲你的圖片網址,而不是簡單的」c:/ ...「。

http://en.wikipedia.org/wiki/File_URI_scheme#Windows_2

+0

thanks..it工作 – user1050619 2012-04-24 18:50:07

+0

注意,當然,這*不會*任何人從計算機查看自己的網頁,除了你的工作。 – 2012-04-25 03:07:15

3

您should'nt參考您的計算機(c:/)的根,但主機的根。

<img src="/jquery/chapter-1/begin/images/img_0229.jpg"> 
1

的Web網址,不要使用驅動器號:

<img src="c:/jquery/chapter-1/begin/images/img_0229.jpg"> < - 這是錯誤的