无法让jQuery在本地工作

Dan*_*wen 2 javascript jquery user-interface load

嘿,我已经检查了更多这样的jQuery问题而不是我记得,但我似乎无法弄明白这一点.

以下代码不会在本地工作.还没有机会在线测试,但我当然应该可以在本地进行测试.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en' xml:lang='en' xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>jQuery test</title>
    <link rel='stylesheet' type='text/css' href='/root/WebDev/jquery-ui-1.10.2.custom/css/ui-lightness/jquery-ui-1.10.2.custom.min.css'/>
  <script type="text/javascript" src="jquery.js"></script>
  <script type="text/javascript" src="/root/WebDev/jquery-ui-1.10.2.custom/js/jquery-1.9.1.js"></script>
  <script type="text/javascript" src="/root/WebDev/jquery-1.9.1.min.js"></script>
</head>
<body>

    <div style="height: 20px;width:20px;background-color:red;position:relative;top:50px;left:50px;"></div>
</body>
Run Code Online (Sandbox Code Playgroud)

和jQuery代码:

$(document).ready(function(){
$('div').click(function(){
    $('div').effect('explode');
});

});
Run Code Online (Sandbox Code Playgroud)

就像一个注释,我确实在本地有那些jquery文件.

Rok*_*jan 5

首先把jQuery,比其他插件,脚本,使用jQuery的!

  <script type="text/javascript" src="/root/WebDev/jquery-1.9.1.min.js"></script>
  <script type="text/javascript" src="/root/WebDev/jquery-ui-1.10.2.custom/js/jquery-1.9.1.js"></script>
  <script type="text/javascript" src="jquery.js"></script>
Run Code Online (Sandbox Code Playgroud)

对于最后一个,如果这是您拥有功能的文件,请确保路径也是正确的,

  • 我不太确定你使用的这条路径:

    /root/WebDev/jquery-ui-1.10.2.custom/js/jquery-1.9.1.js

  • 是否jquery-ui-1.10.2.custom/js/真的是你的文件夹的名称?:)

  • 为什么你不使用Google Hosted Libraries和一些不错的HTML5标记:

<!DOCTYPE html>
<html>
<head>
<link  href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="myfunctions.js"></script>
<meta charset=utf-8 />
<title>All you need</title>
</head>
<body>

   <div style="height: 20px;width:20px;background-color:red;position:relative;top:50px;left:50px;"></div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)