2017-03-15 35 views
-1

我正在嘗試這個網頁上的jquery alert示例:http://www.tutorialscollection.com/jquery-demo/jquery-demo.php?ex=8.0_1。我是新來使用jQuery,我無法弄清楚如何獲得的頭一節中列出的依賴關係:新手:如何添加jQuery插件

<head> 
<script src="jquery.alerts.js" type="text/javascript"></script> 
<link href="jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" /> 

以下是完整的文件,但可能並不需要:

<!DOCTYPE html> 
<head> 
<title>Examples of using jQuery Alerts</title> 
<script src="jquery.js" type="text/javascript"></script> 
<script src="jquery.ui.draggable.js" type="text/javascript"></script> 

<script src="jquery.alerts.js" type="text/javascript"></script> 
<link href="jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" /> 

<!-- Example script --> 
<script type="text/javascript"> 
$(document).ready(function() { 
$("#basic_button").click(function() { 
jAlert('Example of a basic alert box in jquery', 'jquery basic alert box'); 
}); 
}); 
</script> 
</head> 
<body> 
<p> 
<input id="basic_button" type="button" value="Show Basic Alert" /> 
</p> 
</body> 
</html> 
+1

我的猜測是你不遵循文檔不夠緊密。 (寫上說教程的人也不是) –

+0

幾乎肯定是正確的......當所有其他的都失敗時,請閱讀說明書。請指教我說的文件存在或如何解決我的問題;) – thebiggestlebowski

+0

你只是複製和粘貼?如果你這樣做,你可能會遇到依賴問題,因爲瀏覽器正在請求一個不存在或不會被服務的資源。看看使用CDN,如果是這種情況 –

回答

1

Google託管CDN。爲了確保JQuery的libary加載添加到<head>標籤這個

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 

如果你想這樣的本地機器上,那麼你可以下載的jQuery here,並在<head>因爲這樣設置它:

<script src="path_to_jquery" ></script> 
+0

我已更新我的問題。我知道從哪裏得到jQuery;這是我不知道的插件。 – thebiggestlebowski

+0

你有沒有嘗試導入jQuery UI? –

+0

有人不喜歡我們:)我也投了票。好吧 ... – thebiggestlebowski