2010-10-12 16 views
0

對不起,這個跛腳的問題。關於爲什麼我無法運行這個簡單的jquery tablesorter插件示例的任何建議?

我試圖運行一個簡單的getting started tablesorter example沒有運氣。

我知道我的jquery作品,因爲我做了一個'hello world'alert test。

我下載了.js文件,並將它們放在我的工作目錄/文件夾中。

Firebug「Reponse」窗口顯示我的文件中有實際的.js代碼。

Firebug說狀態:「304未修改」,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>[email protected]</td> 
    <td>$50.00</td> 
    <td>http://www.jsmith.com</td> 
</tr> 
<tr> 
    <td>Bach</td> 
    <td>Frank</td> 
    <td>[email protected]</td> 
    <td>$50.00</td> 
    <td>http://www.frank.com</td> 
</tr> 
<tr> 
    <td>Doe</td> 
    <td>Jason</td> 
    <td>[email protected]</td> 
    <td>$100.00</td> 
    <td>http://www.jdoe.com</td> 
</tr> 
<tr> 
    <td>Conway</td> 
    <td>Tim</td> 
    <td>[email protected]</td> 
    <td>$50.00</td> 
    <td>http://www.timconway.com</td> 
</tr> 
</tbody> 
</table> 



</body> 

alt text

回答

0

我忘了下載CSS文件,並讓我的網頁知道它們! woops!

0

它的工作對我很好,當我經過的jsfiddle(link here)跑你的HTML。我知道默認的jQuery文件名是jquery-<version>.js,我發現你的源文件缺少連字符。

你說,源代碼在你的兩個文件中都顯示正確,但是,我不確定這裏有什麼問題。也許jQuery中的某些東西需要默認文件名?

+0

不,我不認爲它是我的代碼工作,但謝謝你試圖向我展示那個jsfiddle網站。我在我的問題中添加了一個圖像,顯示瞭如果我的代碼正常工作,表格的外觀。 – 2010-10-12 20:52:11

相關問題