有关为什么我不能运行这个简单的jquery tablesorter插件示例的任何建议?

时间:2010-10-12 16:02:32

标签: javascript jquery jquery-plugins

抱歉这个蹩脚的问题。

我试图运行一个简单的getting started tablesorter example而没有运气。

我知道我的jquery有效,因为我做了一个'hello world'警报测试。

我下载了.js文件并将它们放在我的工作目录/文件夹中。

Firebug“Reponse”窗口显示文件中有实际的.js代码。

Firebug说状态:“304 Not Modified”,Doamin:“localhost”。

我正在使用WAMP。

<head>


<script src="jquery1.4.2.js" type="text/javascript"></script>
<script src="jquery.tablesorter.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() 
            { 
                $("#myTable").tablesorter(); 
                $("a").click(function() {alert("Hello world!")} );
            }
        );  
</script>



</head>

<body>
<a href="">Link</a>

<table id="myTable"class="tablesorter" border="2" cellpadding="0" cellspacing="1" > 
<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>

alt text

2 个答案:

答案 0 :(得分:0)

当我通过jsfiddle(link here)运行HTML时,它对我来说很好。我知道默认的jQuery文件名是jquery-<version>.js,我看到你的源码缺少连字符。

你说你的两个文件中的源都显示正确,所以我不确定这里有什么问题。也许jQuery中的某些东西需要默认文件名?

答案 1 :(得分:0)

我忘记下载CSS文件并让我的网页了解它们! woops !!