请问谁能帮我解决一下这段订购javascript 代码?
帮我解决一下
<script>
function countMethod(){
var num =document.getElementByName("num").value;
var check_array=document.getElementsByName("check");
for(var i=0;i<check_array.length;i++)
{
if(check_array[i].checked==true)
{
rusult=(check_array[i].value*num);
}
document.getElementByName("result").value=rusult;
}
}
</script>
<table width="685" height="161" border="1" cellpadding="4">
<tr>
<td colspan="5" align="center"> </td>
</tr>
<tr>
<td width="60">编号 </td>
<td width="316">名称</td>
<td width="77">价</td>
<td width="100"> 数量</td>
<td width="68">购买</td>
</tr>
<tr>
<td>a</td>
<td>book</td>
<td>45</td>
<td><input type="text" size="6" name="num" /></td>
<td><input type="checkbox" value="45" name="check"/> </td>
</tr>
<tr>
<td>b</td>
<td>apple</td>
<td>50</td>
<td><input type="text" size="6" name="num2" /></td>
<td><input type="checkbox" value="50" name="check" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><input type="button" value="计" onclick="countMethod()" /> </td>
<td><input type="text" size="10" name="result" /></td>
</tr>
<tr>
</table>
------解决方案----