高手帮忙,如何取得表格内容,在线等,救急!

yyouyou 2005-09-29 10:19:10
html的文件如下,现在想通过javascript取得表格的标题:"序号,仓库,所属单位,种子编号,种子名称,批次号,规格,期初余额,当前余额,其它,所在地",高手指点啊.

<head>

<style>
@media print {
.noprint { display: none; }
}
</style>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>统计表</title>
<style>
<!--
td { font-size: 10pt }
-->
</style>
</head>

<html>

<body topmargin="2" >


<table border="0" cellspacing="0" cellpadding="0" style="height: 2mm; ">
<tr style="page-break-after: always;"><td>
<div align="center">
<table border="1" cellpadding="2" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" id="subTable1" width="720">
<tr>
<td height="23" align="center" bgcolor="#ECE9D8" width="52">
序号</td>
<td width="59" height="23" align="center" bgcolor="#ECE9D8">
仓库</td>
<td width="59" align="center" bgcolor="#ECE9D8">所属单位</td>
<td width="59" height="23" align="center" bgcolor="#ECE9D8">种子编号</td>
<td width="59" height="23" align="center" bgcolor="#ECE9D8"> 种子名称</td>
<td width="49" height="23" align="center" bgcolor="#ECE9D8">批次号</td>
<td height="23" width="49" align="center" bgcolor="#ECE9D8">规格</td>
<td height="23" width="73" align="center" bgcolor="#ECE9D8">期初余额</td>
<td height="23" width="69" align="center" bgcolor="#ECE9D8">当前余额</td>
<td height="23" width="56" align="center" bgcolor="#ECE9D8">其它</td>
<td width="56" align="center" bgcolor="#ECE9D8">所在地</td>
</tr>
<tr><input type="hidden" name="STID" value="" style=""><input type="hidden" name="ID" value="10" style="">
<td height="20"><span id="nom" style="width: 100%; border: 0px; font-size: 9pt;">1</span></td>
<td height="20"><input type='hidden' name='hideColumn'></td>
<td height="20"><span id="ORGNAME" style="width: 100%; border: 0px; font-size: 9pt;">总公司</span></td>
<td height="20"><span id="SEEDID" style="width: 100%; border: 0px; font-size: 9pt;">
1</span></td>
<td height="20"><span id="SEEDNAME" style="width: 100%; border: 0px; font-size: 9pt;">
冈优</span></td>
<td height="20"><span id="CCH" style="width: 100%; border: 0px; font-size: 9pt;">
11</span></td>
<td width="49" height="20"><span id="GOODSTYPE" style="width: 100%; border: 0px; font-size: 9pt;">散装</span></td>
<td width="73" height="20"><span style="font-size: 9pt">111</span></td>
<td width="69" height="20"><span id="CURBALANCE" style="text-align:right; width: 100%; border: 0px; font-size: 9pt;">100</span></td>
<td width="56" height="20"><input type='hidden' name='hideColumn'></td>
<td width="56"><input type='hidden' name='hideColumn'></td>
</tr>
<tr><input type="hidden" name="STID" value="" style=""><input type="hidden" name="ID" value="10" style="">
<td height="20"><span id="nom" style="width: 100%; border: 0px; font-size: 9pt;">2</span></td>
<td height="20"><input type='hidden' name='hideColumn'></td>
<td height="20"><span id="ORGNAME" style="width: 100%; border: 0px; font-size: 9pt;">总公司</span></td>
<td height="20"><span id="SEEDID" style="width: 100%; border: 0px; font-size: 9pt;">
2</span></td>
<td height="20"><span id="SEEDNAME" style="width: 100%; border: 0px; font-size: 9pt;">
冈优</span></td>
<td height="20"><span style="font-size: 9pt">22</span></td>
<td width="49" height="20"><span id="GOODSTYPE" style="width: 100%; border: 0px; font-size: 9pt;">散装</span></td>
<td width="73" height="20"><span style="font-size: 9pt">222</span></td>
<td width="69" height="20"><span id="CURBALANCE" style="text-align:right; width: 100%; border: 0px; font-size: 9pt;">100</span></td>
<td width="56" height="20"><input type='hidden' name='hideColumn'></td>
</tr>
</body>
</html>
...全文
67 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yyouyou 2005-09-29
谢谢了
回复
JK_10000 2005-09-29
<script>


alert(subTable1.rows[0].innerText)
alert(subTable1.rows[0].cells[0].innerText)

</script>
回复
w_lion 2005-09-29
标题也写在<td>中取<td>中的值
回复
发动态
发帖子
JavaScript
创建于2007-09-28

8.4w+

社区成员

Web 开发 JavaScript
申请成为版主
社区公告
暂无公告