Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/413.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
Javascript 启动tablesorter时遇到问题_Javascript_Jquery_Tablesorter - Fatal编程技术网

Javascript 启动tablesorter时遇到问题

Javascript 启动tablesorter时遇到问题,javascript,jquery,tablesorter,Javascript,Jquery,Tablesorter,下面是在上提供的演示示例。我已经确认jquery工作正常。但是,我尝试重新创建演示,jquery.tablesorter.js根本没有产生任何更改。输出仍然是一个纯HTML文本表 我错过了什么 myTable.html <!DOCTYPE html> <html> <head> <script type="text/javascript" src="../js/myTable.js"></script> <script

下面是在上提供的演示示例。我已经确认jquery工作正常。但是,我尝试重新创建演示,jquery.tablesorter.js根本没有产生任何更改。输出仍然是一个纯HTML文本表

我错过了什么

myTable.html

<!DOCTYPE html>
<html>

 <head>

 <script type="text/javascript" src="../js/myTable.js"></script>
 <script type="text/javascript" src="../js/jquery-1.10.1.min.js"></script> 
 <script type="text/javascript" src="../js/__jquery.tablesorter/jquery.tablesorter.js"></script>

 </head>

 <body>

 <table id="myTable" class="tablesorter"> 
  <thead> 
    <tr> 
      <th>Last Name</th> 
      <th>First Name</th> 
      <th>Email</th> 
      <th>Due</th> 
      <th>Web Site</th> 
    </tr> 
  </thead> 
  <tbody> 
    <tr> 
      <td>Smith</td> 
      <td>John</td> 
      <td>jsmith@gmail.com</td> 
      <td>$50.00</td> 
      <td>http://www.jsmith.com</td> 
    </tr> 
    <tr> 
      <td>Bach</td> 
      <td>Frank</td> 
      <td>fbach@yahoo.com</td> 
      <td>$50.00</td> 
      <td>http://www.frank.com</td> 
    </tr> 
    <tr> 
      <td>Doe</td> 
      <td>Jason</td> 
      <td>jdoe@hotmail.com</td> 
      <td>$100.00</td> 
      <td>http://www.jdoe.com</td> 
    </tr> 
    <tr> 
      <td>Conway</td> 
      <td>Tim</td> 
      <td>tconway@earthlink.net</td> 
      <td>$50.00</td> 
      <td>http://www.timconway.com</td> 
    </tr> 
  </tbody> 
</table>

</body>
</html>

将jQuery和tablesorter包含移到js/myTable.js之前:

 <head>

 <script type="text/javascript" src="../js/jquery-1.10.1.min.js"></script> 
 <script type="text/javascript" src="../js/__jquery.tablesorter/jquery.tablesorter.js"></script>
 <script type="text/javascript" src="../js/myTable.js"></script>

 </head>


控制台中有错误吗?文件路径中的下划线是怎么回事?是的,ReferenceError:$未定义js/myTable.js第1行我对调试部分还很陌生。我不知道这是什么意思。我的意思是,当我使用jQuery隐藏/显示内容时,这通常会起作用。@MarcoLau如果没有包含jQuery,请检查路径。@MarcoLau抱歉,找到了。将jQuery包含移到js/myTable.js之前。@MarcoLau和tablesorter必须包含在js/myTable.js之前,编辑答案。
 <head>

 <script type="text/javascript" src="../js/jquery-1.10.1.min.js"></script> 
 <script type="text/javascript" src="../js/__jquery.tablesorter/jquery.tablesorter.js"></script>
 <script type="text/javascript" src="../js/myTable.js"></script>

 </head>