2017-03-15 37 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