Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery-背景仍然没有改变_Jquery_Jquery Ui_Background Color - Fatal编程技术网

jQuery-背景仍然没有改变

jQuery-背景仍然没有改变,jquery,jquery-ui,background-color,Jquery,Jquery Ui,Background Color,可能重复: 我知道我已经发布了好几次类似的问题,但我真的很困惑为什么不工作 这是我的最新版本的代码: HTML <html> <head> <script type="text/javascript" src="jquery-1.6.4.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>

可能重复:

我知道我已经发布了好几次类似的问题,但我真的很困惑为什么不工作

这是我的最新版本的代码:

HTML

<html>
<head>
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="script.js"></script>
<style type="text/css"> 
#name{
background-color: #FFFFF2;
width: 100px;
}
</style>
</head>
<body>
<input type="button" id="bgcolor" value="Change color"/>
<div id="name">
Abder-Rahman
</div>
</body>
</html>
我想注意,我有一个名为:
jquery-ui-1.8.16.custom
的文件夹,这就是我放置这些文件的地方。并且,我引用了如上所示的
jquery-1.6.4,js
,除了引用当前文件夹中
js
文件夹中的
jquery-ui-1.8.16.custom.min.js
之外,我还在同一文件夹中引用了它

我这里出了什么错?这不是引用
jQuery
jQueryUI
的方法吗

编辑

使用的浏览器:Mozilla Firefox 6.0.2

文件夹结构: jquery-ui-1.8.16.custom/abc.html jquery-ui-1.8.16.custom/script.js jquery-ui-1.8.16.custom/jquery-1.6.4.js jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js


谢谢。

您是否将其置于“窗口”或“文档加载”功能中?此页面是否与脚本位于同一文件夹中

$(document).ready(function(){
    $("#bgcolor").click(function(){
    $("#name").animate(
        {backgroundColor: '#8B008B'},
        "fast");}
);
});

您可能不知何故没有包括jQueryUI,因为这就是彩色动画的来源。您的jquery-ui-1.8.16.custom.min.js是否位于名为js的文件夹中?你也应该把你的文件夹结构也包括在这个问题中,因为不清楚哪里出了问题。此外,如果浏览器中存在这样的问题,您可能希望查看浏览器的开发人员控制台(它可能会告诉您加载失败的文件或语法错误)。您还应提及您使用的浏览器,以便更轻松地为您提供帮助。

不要连续提问。如果要添加内容,请编辑上一个。另外,和回答你的人沟通,如果他们的回答对你不起作用,可以询问进一步的澄清。不要只问新问题而不先尽力解决第一个问题。该页面与我的脚本位于同一文件夹中。但是,我应该包括一个``onload()`函数吗?我认为没有这个就可以了,因为我已经包含了脚本如果你不把它放在onload函数中,那么脚本会在文档准备好之前运行,这意味着你的bgcolor元素还不存在。在这种情况下,当我在
标记中插入
onload
时,它应该等于什么?i、 e`onload=???``。谢谢如果你注意到的话,我正试图通过触发一个按钮来运行脚本。那么,这还不足以让文档准备就绪吗?您正在尝试向不存在的内容添加事件处理程序。
$(document).ready(function(){
    $("#bgcolor").click(function(){
    $("#name").animate(
        {backgroundColor: '#8B008B'},
        "fast");}
);
});