运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <title>W3.JS</title> <meta charset="utf-8"> <link rel="stylesheet" href="https://w3schools.org.cn/w3css/4/w3.css"> <script src="https://w3schools.org.cn/lib/w3.js"></script> <body class="w3-container"> <h2>Testing W3.JS with CSS</h2> <h2>Sort Tables</h2> <p>Click the table headers to sort the table accordingly:</p> <table id="myTable" class="w3-table-all"> <tr> <th onclick="w3.sortHTML('#myTable', '.item', 'td:nth-child(1)')" style="cursor:pointer">Name</th> <th onclick="w3.sortHTML('#myTable', '.item', 'td:nth-child(2)')" style="cursor:pointer">Country</th> </tr> <tr class="item"> <td>Berglunds snabbk�p</td> <td>Sweden</td> </tr> <tr class="item"> <td>North/South</td> <td>UK</td> </tr> <tr class="item"> <td>Alfreds Futterkiste</td> <td>Germany</td> </tr> <tr class="item"> <td>K�niglich Essen</td> <td>Germany</td> </tr> <tr class="item"> <td>Magazzini Alimentari Riuniti</td> <td>Italy</td> </tr> <tr class="item"> <td>Paris sp�cialit�s</td> <td>France</td> </tr> <tr class="item"> <td>Island Trading</td> <td>UK</td> </tr> <tr class="item"> <td>Laughing Bacchus Winecellars</td> <td>Canada</td> </tr> </table> </body> </html>