下面这个代码通过document.getElementById("cd1").innerText = gaodu-40;把值填到第一个单元格,如果我想填到所有单元格,并且表格外面也要几个,应该怎么做
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function jisuan(){
var gaodu = document.getElementById("gd").value;
var kuandu = document.getElementById("kd").value;
var shuliang = document.getElementById("sl").value;
document.getElementById("cd1").innerText = gaodu-40;
}</script>
</head>
<body onload="jisuan(this)" >
<form id="form1" name="form1" method="post" action="">
高度
<input type="text" id="gd" value="1600" />
宽度<input type="text" id="kd" value="600" />
数量<input type="text" id="sl" value="1" /><input type="button" onClick="jisuan(this)" value="计算" />
</form>
<table width="200" border="1">
<tr>
<td id="cd1"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>