日期:2014-05-16  浏览次数:20383 次

html js表格排序的问题?
请帮忙看看这个 js 表格问题,为何新增的两个项后,后幸的项单击不排序,请教要JS该如何更改?

代码完整示例如下:(由于代码太长了分两次打复制)谢谢:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>Table</title> 
<style type="text/css"> 
body{ font-size:12px} 
#tab{ border-collapse: collapse;} 
.edit{ height:16px; width:98%; background-color:#EFF7FF; font-size:12px; border:0px;} 
#tab thead td{ background:url(/upload/201005/20100531233452190.bmp);color:#183C94} 
#tab tbody td{ overflow:hidden} 
#tab td{border: 1px solid #CECFCE;height:20px;line-height:20px;vertical-align:middle; } 
#tab td.tc{text-align:center;} 
.cc{width:10px;height:6px; border:1px solid #999999; background-color:#FFFFFF; position:absolute; display:none;} 
#tab td.red{border-color:#f30;} 
.ww{height:100%;width:1px;background:#CECFCE;float:right;margin-right:-1px;cursor:sw-resize} 

.line{ width:2px; background-color:#999999; position:absolute; display:none} 
</style> 
</head> 
<body> 
<table id="tab" border="0" cellspacing="1" cellpadding="0"> 
<thead> 
<tr> 
<td width="60"class="tc" ><span>ID</span><div class="ww"></div></td> 
<td width="60"class="tc"><span>选中</span><div class="ww"></div></td> 
<td width="100" class="tc"><span>姓名</span><div class="ww"></div></td> 
<td width="100" class="tc" ><span>生日</span><div class="ww"></div></td> 
<td width="180" class="tc" ><span>备注</span><div class="ww"></div></td> 
<td width="180" class="tc" ><span>新增的项</span><div class="ww"></div></td> 
<td width="180" class="tc" ><span>新增的项</span><div class="ww"></div></td> 
</tr> 
</thead> 
<tbody> 
<tr> 
<td height="16">1</td> 
<td><input type ="checkbox"></td> 
<td>张三</td> 
<td>1982-05-27</td> 
<td>杯具,全是杯具</td> 
<td>杯具,全是杯具</td>
<td>杯具,全是杯具</td>
</tr> 
<tr> 
<td>3</td> 
<td><input type ="checkbox"></td> 
<td>李四</td> 
<td>1983-06-27</td> 
<td>恩恩我魔兽技术不错</td> 
<td>杯具,全是杯具</td>
<td>杯具,全是杯具</td>
</tr> 
<tr> 
<td>2</td> 
<td><input type ="checkbox"></td> 
<td>王五</td> 
<td>1983-05-27</td> 
<td>波斯王子 时之刃还不错</td> 
<td>杯具,全是杯具</td>
<td>杯具,全是杯具</td>
</tr> 
<tr> 
<td>4</td> 
<