Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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/0/unity3d/4.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
$notdefined错误在jquery中 //_Jquery - Fatal编程技术网

$notdefined错误在jquery中 //

$notdefined错误在jquery中 //,jquery,Jquery,由于某些原因,jQuery没有加载 检查您的路径是否确实是src=“jquery-1.4.2.min.js”?或者可能是:src=“jquery/1.4.2.min.js” 确保正在加载jQuery。转到源页面,确保您可以阅读它。要调试,请使用源的完整URL,而不仅仅是相对路径。然后,如果这样做有效,将其更改为相对路径,然后查看它是否仍然有效 您的第一个标记格式不正确: 格式不正确: <script type= "text/javascript" src = "jquer

由于某些原因,jQuery没有加载

检查您的路径是否确实是
src=“jquery-1.4.2.min.js”
?或者可能是:
src=“jquery/1.4.2.min.js”

确保正在加载jQuery。转到源页面,确保您可以阅读它。要调试,请使用源的完整URL,而不仅仅是相对路径。然后,如果这样做有效,将其更改为相对路径,然后查看它是否仍然有效


您的第一个
标记格式不正确:

格式不正确:

<script type= "text/javascript"
        src = "jquery-1.4.2.min.js"></script>

<script type= "text/javascript">


   //<!CDATA[[

$(init);

function init() {
 $("#heading").load("head.html");
 $("#menu").load("menu.html");
 $("#content1").load("story.html");
 $("#content2").load("story2.html");
 $("#footer").load("footer.html");
};

  //]]>

</script>
<script type= "text/javascript"
        src = "jquery-1.4.2.min.js"</script>
而不是:

//<![CDATA[

/确保正确引用jQuery.js文件,通过添加警报('HIT!')进行测试;如果您不确定,请在jQuery文件中

完成排序后,请执行以下操作:

//<!CDATA[[

并在结束正文标记之前调用init()。

请确保不使用,这将删除
$
别名,以避免与其他JavaScript库冲突。

已修复,但仍然表示$defined@user449914-检查jquery是否正在加载。。。在转到该url后,请尝试输入完整的url作为源,以确保文件确实在那里。@user449914-它应该正在加载,但实际上没有加载。最初使用完整URL有助于调试。您可以通过浏览器导航到jQuery代码页吗?愚蠢的错误…jQuery文件位于其他文件夹中!!对不起,谢谢@user44914-不客气;)每个人都会这样。这只是一场耐心的游戏。如果我的回答能解决你的问题,别忘了接受。(计票下面的绿色复选标记)。您不需要使用document.ready函数吗?您在上面的代码片段中包含jquery的位置在哪里?我相信可以使用$()启动,无需使用document.ready withjquery@Oskar
$(handler)
$(document)的同义词。ready(handler)
@Peter谢谢,我不知道
//<!CDATA[[
<script type= "text/javascript">

$(function(){
 $("#heading").load("head.html");
 $("#menu").load("menu.html");
 $("#content1").load("story.html");
 $("#content2").load("story2.html");
 $("#footer").load("footer.html");});

</script>
function init() {
 $("#heading").load("head.html");
 $("#menu").load("menu.html");
 $("#content1").load("story.html");
 $("#content2").load("story2.html");
 $("#footer").load("footer.html");
};