只有第一行,其余行不能自动就算
<script language="JavaScript" type="text/javascript">function js(id1,id2,id4)
{
var o1 = document.getElementById(id1);
var o2 = document.getElementById(id2);
var o4 = document.getElementById(id4);
total = parseInt(o1.value)*parseInt(o2.value);
o4.value =total;
}
</script>
<form name="form1" method="post" action="">
<table width="96%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
<tr>
<td>序号</td>
<td>项目</td>
<td>单价</td>
<td>数量</td>
<td>总金额</td>
<td>备注</td>
</tr>
<%
sql="select * from zxc "
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
Do While Not rs.eof
%>
<tr align="center" bgcolor='#F2FDFF'>
<td width="5%" align='left'><%=rs("id")%></td>
<td width="10%" align='left'><%=rs("xiangmu")%></td>
<td width="10%" align='left'><input name="danjia" type="text" id="Ya" value=<%=rs("danjia")%> onChange="js('Ya','Sa','Ta')"></td>
<td width="10%" align='left' ><input name="shuliang" type="text" id="Sa" onChange="js('Ya','Sa','Ta')"></td>
<td width="10%" align='left'><input name="zongjine" type="text" id="Ta" onChange="js('Ya','Sa','Ta')"></td>
<td width="55%" align='left'><%=rs("beizhu")%></td>
</tr>
<%
rs.movenext
Loop
rs.close
Set rs=Nothing
%>
</table>