过滤表格中的链接(用javascript提取表格中的数据)
发表于:2007-06-30来源:作者:点击数:
标签:
费话少说看代码! meta http-equiv=Content-Type content=text/html; charset=gb2312 TABLE class=clsSysTab cellSpacing=0 borderColorDark=#ccffcc cellPadding=0 width=100% align=center borderColorLight=#396942 border=1 TBODY TR class=clsSystab_trTi
费话少说看代码!
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TABLE class=clsSysTab cellSpacing=0 borderColorDark=#
clearcase/" target="_blank" >ccffcc cellPadding=0 width="100%" align=center borderColorLight=#396942 border=1>
<TBODY>
<TR class=clsSystab_trTitle>
<
TD align=middle>员工ID</TD>
<TD align=middle>中文姓名</TD>
<TD align=middle>英文姓名</TD>
<TD align=middle>部门ID</TD>
<TD align=middle>身份证号</TD>
<TD align=middle>出生日期</TD>
<TD align=middle>Email</TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=YG1454">YG1454</A></TD>
<TD class=YgxxTableTD>fsdafs </TD>
<TD class=YgxxTableTD>fsadf </TD>
<TD class=YgxxTableTD>大 </TD>
<TD class=YgxxTableTD>fsadfsd </TD>
<TD class=YgxxTableTD>2001-10-16 </TD>
<TD class=YgxxTableTD>4234234 </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=YG1445">YG1445</A></TD>
<TD class=YgxxTableTD>sdds </TD>
<TD class=YgxxTableTD>dsd </TD>
<TD class=YgxxTableTD>组织结构 </TD>
<TD class=YgxxTableTD>fsdfd </TD>
<TD class=YgxxTableTD>2001-1-1 </TD>
<TD class=YgxxTableTD>fsdafs </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=YGIII">YGIII</A></TD>
<TD class=YgxxTableTD>李二 </TD>
<TD class=YgxxTableTD>lier </TD>
<TD class=YgxxTableTD>组织结构 </TD>
<TD class=YgxxTableTD>43423423423 </TD>
<TD class=YgxxTableTD>1977-9-9 </TD>
<TD class=YgxxTableTD>4gsdfgdfsg </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=ccc">ccc</A></TD>
<TD class=YgxxTableTD>ccc </TD>
<TD class=YgxxTableTD>cccc </TD>
<TD class=YgxxTableTD>技术一部 </TD>
<TD class=YgxxTableTD>11111 </TD>
<TD class=YgxxTableTD>1977-9-9 </TD>
<TD class=YgxxTableTD>ccc </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=cdg1428">cdg1428</A></TD>
<TD class=YgxxTableTD>dasd </TD>
<TD class=YgxxTableTD>dasda </TD>
<TD class=YgxxTableTD>组织结构 </TD>
<TD class=YgxxTableTD>3213123 </TD>
<TD class=YgxxTableTD>2001-9-4 </TD>
<TD class=YgxxTableTD>eqweqwe </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=test">test</A></TD>
<TD class=YgxxTableTD>test </TD>
<TD class=YgxxTableTD>test </TD>
<TD class=YgxxTableTD>组织结构 </TD>
<TD class=YgxxTableTD>32132 </TD>
<TD class=YgxxTableTD>1977-9-9 </TD>
<TD class=YgxxTableTD>test.com </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=hestia2">hestia2</A></TD>
<TD class=YgxxTableTD>小猫 </TD>
<TD class=YgxxTableTD>hestia2 </TD>
<TD class=YgxxTableTD>食品分公司 </TD>
<TD class=YgxxTableTD>4237498234 </TD>
<TD class=YgxxTableTD>2001-9-2 </TD>
<TD class=YgxxTableTD>fdsf@fdsaf.com </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=hestia1">hestia1</A></TD>
<TD class=YgxxTableTD>诺亚 </TD>
<TD class=YgxxTableTD>hestia1 </TD>
<TD class=YgxxTableTD>部门A </TD>
<TD class=YgxxTableTD>456123 </TD>
<TD class=YgxxTableTD>2001-9-3 </TD>
<TD class=YgxxTableTD>aa@aa.com </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=cdg1421">cdg1421</A></TD>
<TD class=YgxxTableTD>aasdf </TD>
<TD class=YgxxTableTD>asfd </TD>
<TD class=YgxxTableTD>食品分公司 </TD>
<TD class=YgxxTableTD>21341234 </TD>
<TD class=YgxxTableTD>2001-9-18 </TD>
<TD class=YgxxTableTD>asdf </TD></TR>
<TR class=clsSysTab_trContent onmouseover="this.style.backgroundColor=@##f0f5f7@#;" onmouseout="this.style.backgroundColor=@#@#; " vAlign=center align=middle>
<TD><A href="?act=view&uid=cdg1420">cdg1420</A></TD>
<TD class=YgxxTableTD>asdf </TD>
<TD class=YgxxTableTD>asdf </TD>
<TD class=YgxxTableTD>组织结构 </TD>
<TD class=YgxxTableTD>22222222229999999999 </TD>
<TD class=YgxxTableTD>2001-9-18 </TD>
<TD class=YgxxTableTD>dffsdfsd </TD></TR></TBODY></TABLE>
<p>----------------------------------------------------下面是过滤过的效果 </p>
<p>
<script>
var
td_num=document.all.tags("td").length;
var tr_num=document.all.tags("tr").length;
var cols=td_num/tr_num;
var i,j;
document.write ("<table border=1")
for (i=1;i<tr_num+1;i++){
document.write ("\n<tr>");
for (j=1;j<cols+1;j++){
document.write ("\n<td>");
document.write (document.all.tags("td")((i*cols-8)+j).innerText);
document.write ("\n</td>");
}
document.write ("\n</tr>");
}
document.write ("</table>")
</script>
</p>
原文转自:http://www.ltesting.net