Hjælp til Formular og udregning
Nogen der kan hjælpe med følgende:(problemområderne markeret med HJÆLP:
<%
mySQL="select count(Id) As antal from produkt"
set conntemp=server.createobject("adodb.connection")
conntemp.open StrConnect
set rstemp=conntemp.execute(mySQL)
mySQL="select * from produkt"
howmanyfields =(rstemp("antal")-1)
mySQL="select * from produkt"
set rstemp=conntemp.execute(mySQL)
%>
<form method="POST">
<script>
function regnfor(f){
f.total.value =<%
for i=0 to howmanyfields%>
HJÆLP: HVIS f.tal<%=(i)+1%> ER STØRRE END XX THEN
+ ((f.pris<%=(i)+1%>.value) * (f.tal<%=(i)+1%>.value - 0))
HJÆLP:: ELSE
+ ((f.prisx<%=(i)+1%>.value) * (f.tal<%=(i)+1%>.value - 0))
HJÆLP: END IF
<% next %> ;
}
</script>
<div align="left"><table border="0" cellpadding="4" cellspacing="0"
width="700">
<tr>
<% x =0
do while not rstemp.eof
%>
<input type = "hidden" id="pris<%=(x)+1%>" name="pris<%=(x)+1%>" value="<%=rstemp("forhandlerpris1")%>">
<input type = "hidden" id="prisx<%=(x)+1%>" name="prisx<%=(x)+1%>" value="<%=rstemp("forhandlerpris2")%>">
<td width="100" style="padding-top: 0px; padding-bottom: 0px"><input id="tal<%=(x)+1%>" size="8"
name="tal<%=(x)+1%>" style=" text-align: right" onChange="regnfor(this.form)"> </td>
<td width="150" style="padding-top: 0px; padding-bottom: 0px">Pris under 10 stk = <%=rstemp("forhandlerpris1")%> </td>
<td width="150" style="padding-top: 0px; padding-bottom: 0px">Pris over 10 stk = <%=rstemp("forhandlerpris2")%> </td>
<td width="300" style="padding-top: 0px; padding-bottom: 0px"><%=rstemp("beskrivelse")%></td>
</tr>
<% rstemp.movenext
x = x + 1
loop%>
<script language="javascript">
function skrivebeskyt (f){
document.getElementById("f.total").disabled
}
</script>
<tr>
<td width="100" style="padding-top: 4px; padding-bottom: 4px"><input id="total" size="8"
name="total" style=" text-align: right" READONLY></td>
<td width="500" style="padding-top: 4px; padding-bottom: 4px">Samlet, afdeling</td>
</tr>
</table>
</div><p> </p>
</form>
</body>
</html>
