dakoz
Programmer
- Feb 2, 2002
- 74
hi there i have a script which when you check some checkboxes in a form it calculates the sum of MBs checked and the price which will cost. The price changes every 700MB (One CD)
I Give the user the following output :
450MB
20 Euro --> Check Out
i want to give
450MB (1CD)
20 Euro -->Check Out
This is not my script and i get comfuzed where to put the cd counter.. could you help me?? This is the code:
<script language="JavaScript">
<!--
function schet(f,size){
var cd=new Array();
cd[0]="0";
cd[1]="13";
cd[2]="23";
cd[3]="35";
cd[4]="45";
cd[5]="54";
cd[6]="63";
cd[7]="70";
cd[8]="77";
cd[9]="84";
cd[10]="90";
size=size-0;
summa=document.list.summa.value;
summa=summa-0;
if (f.checked) {
bew=document.list.price.value;
if (bew==0) {
document.list.price.value=cd[1];
with(document.list)
ress.innerText = cd[1]+" euro";
}
summa1=summa+size;
summa1 = Math.round(summa1*10)/10;
document.list.summa.value=summa1;
with(document.list)
res.innerText = summa1;
for (k=1;k<100;k++){
if (summa<k*700){
i=k*700;
break;
}
}
if ((summa<i)&&(summa1>=i)){
o=k+1;
document.list.price.value=cd[o];
with(document.list)
ress.innerText = cd[o]+" euro";
}
}
else {
summa1=summa-size;
summa1 = Math.round(summa1*10)/10;
document.list.summa.value=summa1;
with(document.list)
res.innerText = summa1;
for (k=1;k<100;k++){
if (summa<k*700){
i=(k-1)*700;
break;
}
}
if ((summa>i)&&(summa1<=i)){
o=k-1;
document.list.price.value=cd[o];
with(document.list)
ress.innerText = cd[o]+" euro";
}
}
}
-->
</script>
and i the main body if one box is checked i give dynamically the MB Size and price
<span id=res></span><input type="hidden" name="summa" value="0"> MB
<HR width=80% style="height: 1pt;color
FDFDF;">
Price: <span id=ress>0 euro</span><input type="hidden" name="price" value="0"><BR>
<input type="submit" value="Check Out">
<input type="hidden" name="mode" value="listing"></form>
<A Href="#"><FONT FACE=VERDANA SIZE=1>Buy All (9 CDS)</FONT></A>
</CENTER><BR>
I Give the user the following output :
450MB
20 Euro --> Check Out
i want to give
450MB (1CD)
20 Euro -->Check Out
This is not my script and i get comfuzed where to put the cd counter.. could you help me?? This is the code:
<script language="JavaScript">
<!--
function schet(f,size){
var cd=new Array();
cd[0]="0";
cd[1]="13";
cd[2]="23";
cd[3]="35";
cd[4]="45";
cd[5]="54";
cd[6]="63";
cd[7]="70";
cd[8]="77";
cd[9]="84";
cd[10]="90";
size=size-0;
summa=document.list.summa.value;
summa=summa-0;
if (f.checked) {
bew=document.list.price.value;
if (bew==0) {
document.list.price.value=cd[1];
with(document.list)
ress.innerText = cd[1]+" euro";
}
summa1=summa+size;
summa1 = Math.round(summa1*10)/10;
document.list.summa.value=summa1;
with(document.list)
res.innerText = summa1;
for (k=1;k<100;k++){
if (summa<k*700){
i=k*700;
break;
}
}
if ((summa<i)&&(summa1>=i)){
o=k+1;
document.list.price.value=cd[o];
with(document.list)
ress.innerText = cd[o]+" euro";
}
}
else {
summa1=summa-size;
summa1 = Math.round(summa1*10)/10;
document.list.summa.value=summa1;
with(document.list)
res.innerText = summa1;
for (k=1;k<100;k++){
if (summa<k*700){
i=(k-1)*700;
break;
}
}
if ((summa>i)&&(summa1<=i)){
o=k-1;
document.list.price.value=cd[o];
with(document.list)
ress.innerText = cd[o]+" euro";
}
}
}
-->
</script>
and i the main body if one box is checked i give dynamically the MB Size and price
<span id=res></span><input type="hidden" name="summa" value="0"> MB
<HR width=80% style="height: 1pt;color
Price: <span id=ress>0 euro</span><input type="hidden" name="price" value="0"><BR>
<input type="submit" value="Check Out">
<input type="hidden" name="mode" value="listing"></form>
<A Href="#"><FONT FACE=VERDANA SIZE=1>Buy All (9 CDS)</FONT></A>
</CENTER><BR>