# Dynamic form with multiplication

Printable View

• May 20, 2007, 18:01
\$BsW\$
Dynamic form with multiplication
Hi all,
I'm having a problem with a dynamic form,specifically with a multiplication.
If I don't solve this problem I cannot start my site...it will be a big regret..:cry:

I'm learning js since last weekend so I'm asking you to help me with your experience. Hope you will find a solution or write an example script so that i can understand.

Quote:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script language="JavaScript" type="text/javascript">
function dennis(selezionata){
ar_uno=new Array()
ar_due=new Array()
ar_tre=new Array()
ar_quattro=new Array()
ar_uno[0]=new Option('','')
ar_uno[1]=new Option('0.001','0.001')
ar_uno[2]=new Option('0.002','0.002')
ar_uno[3]=new Option('0.003','0.003')
ar_uno[4]=new Option('0.004','0.004')
ar_uno[5]=new Option('0.005','0.005')
ar_uno[6]=new Option('0.006','0.006')
ar_uno[7]=new Option('0.007','0.007')
ar_uno[8]=new Option('0.008','0.008')
ar_uno[9]=new Option('0.009','0.009')
ar_uno[10]=new Option('0.01','0.01')

ar_due[0]=new Option('','')
ar_due[1]=new Option('0.0015','0.0015')
ar_due[2]=new Option('0.003','0.003')
ar_due[3]=new Option('0.0045','0.0045')
ar_due[4]=new Option('0.006','0.006')
ar_due[5]=new Option('0.0075','0.0075')
ar_due[6]=new Option('0.009','0.009')
ar_due[7]=new Option('0.0105','0.0105')
ar_due[8]=new Option('0.0120','0.0120')
ar_due[9]=new Option('0.0135','0.0135')
ar_due[10]=new Option('0.015','0.015')

ar_tre[0]=new Option('','')
ar_tre[1]=new Option('0.0005','0.0005')
ar_tre[2]=new Option('','')
ar_tre[3]=new Option('','')
ar_tre[4]=new Option('','')
ar_tre[5]=new Option('','')
ar_tre[6]=new Option('','')
ar_tre[7]=new Option('','')
ar_tre[8]=new Option('','')
ar_tre[9]=new Option('','')
ar_tre[10]=new Option('','')

ar_quattro[0]=new Option('','')
ar_quattro[1]=new Option('0.0005','0.0005')
ar_quattro[2]=new Option('','')
ar_quattro[3]=new Option('','')
ar_quattro[4]=new Option('','')
ar_quattro[5]=new Option('','')
ar_quattro[6]=new Option('','')
ar_quattro[7]=new Option('','')
ar_quattro[8]=new Option('','')
ar_quattro[9]=new Option('','')
ar_quattro[10]=new Option('','')

if(selezionata=="uno")array_rif=ar_uno
if(selezionata=="due")array_rif=ar_due
if(selezionata=="tre")array_rif=ar_tre
if(selezionata=="quattro")array_rif=ar_quattro
for(i=0;i<array_rif.length;i++){
document.form1.seconda.options[i]=array_rif[i]
}
}

</script>
</head>
<body>
<form name="form1">
<select name="prima" onChange="dennis(this[this.selectedIndex].value)">
<option value="uno">Paid Clicks</option>
<option value="due">Unique Paid Clicks</option>
<option value="tre">Banner Rotator(Header)</option>
<option value="quattro">Text Ad(Header)</option>
</select>
<select name="seconda">
<option value="uno1">0.001</option>
<option value="uno2">0.002</option>
<option value="uno3">0.003</option>
<option value="uno4">0.004</option>
<option value="uno5">0.005</option>
<option value="uno6">0.006</option>
<option value="uno7">0.007</option>
<option value="uno8">0.008</option>
<option value="uno9">0.009</option>
<option value="uno10">0.010</option>
</select>
<input type="text" name="qt0" onchange="[?]">
<input style="font-weight:bold;color:red" type="text" name="stot" value="0" readonly>
</form>
</body>
</html>

Here is the form:
http://www.queezo.com/index.htm

I need to find the result of:

stot = selected_value_from_seconda*amount_written_in_qt0

The problem is that there are different values for Paid Clicks, Unique Paid Clicks, Banner Rotator and Text Ad and i can't find the right code to get the result.

Thanks in advance,
BsW