【问题标题】:Tablesorter example not working表格排序器示例不起作用
【发布时间】:2009-11-03 12:25:13
【问题描述】:

这应该可行:

<head>
    <title>Damn</title>
    <script src="jquery-latest.js" type="text/javascript"/>
    <script src="jquery.tablesorter.min.js" type="text/javascript"/>
    <script type="text/javascript">
    $(document).ready(function() {      
        $("#tablesorter-demo").tablesorter();
    }); 
</script>
</head>
<body>
    <table id="tablesorter-demo" class="tablesorter" border="2" cellpadding="0" cellspacing="1">
    <thead>
        <tr>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Age</th>
            <th>Total</th>
            <th>Discount</th>
            <th>Difference</th>
            <th>Date</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Peter</td>

            <td>Parker</td>
            <td>28</td>
            <td>$9.99</td>
            <td>20.9%</td>
            <td>+12.1</td>
            <td>Jul 6, 2006 8:14 AM</td>

        </tr>
        <tr>
            <td>John</td>
            <td>Hood</td>
            <td>33</td>
            <td>$19.99</td>
            <td>25%</td>

            <td>+12</td>
            <td>Dec 10, 2002 5:14 AM</td>
        </tr>
        <tr>
            <td>Clark</td>
            <td>Kent</td>
            <td>18</td>
            <td>$15.89</td>
            <td>44%</td>
            <td>-26</td>
            <td>Jan 12, 2003 11:14 AM</td>
        </tr>
    </tbody>
    </table>
</body>

但事实并非如此。
我做错了什么?
注意:我不太了解,但这似乎遵循Tablesorter主页上的示例而没有错误。
而且我知道我会感到非常羞愧。

【问题讨论】:

  • 使用 firebug(firefox 插件)来确定您的页面上是否有任何脚本错误导致 tablesorter 无法触发。如果出现任何错误,请告诉我们。
  • 您确定已将必要的文件包含在适当的位置吗?

标签: jquery tablesorter


【解决方案1】:

正确关闭你的脚本标签

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

你必须用&lt;/script&gt;关闭它

【讨论】:

  • 为此 +1。您不能使用自关闭标签关闭您的脚本标签,否则它们将不起作用。 :)
【解决方案2】:

我刚刚运行了它,它运行良好,只是我必须将完整路径放入 table sortet 脚本文件,因为我没有它们。

<script src="http://tablesorter.com/jquery-latest.js" type="text/javascript"></script> 
<script src="http://tablesorter.com/jquery.tablesorter.min.js" type="text/javascript"/>

【讨论】:

    【解决方案3】:

    这 2 个实际上指向现有文件吗?

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-11
      • 1970-01-01
      • 2018-10-21
      • 2016-11-05
      • 2021-08-22
      • 2019-03-09
      • 2017-04-17
      • 1970-01-01
      相关资源
      最近更新 更多