구입수량 대비 단가. 가격이 자동적으로 변경하는 스크립트입니다.
<table><tr><td>
<script language=javascript>
function ChkForm(form) {
if(form.money1.value < 5) {
form.money2.value=3500;
form.sum.value = parseInt(form.money1.value) * parseInt(form.money2.value);
return;
} else if ( (form.money1.value >= 5) && (form.money1.value < 10)) {
form.money2.value=2800;
form.sum.value = parseInt(form.money1.value) * parseInt(form.money2.value);
return;
} else if ( (form.money1.value >= 10) && (form.money1.value < 30)) {
form.money2.value=2500;
form.sum.value = parseInt(form.money1.value) * parseInt(form.money2.value);
return;
} else if ( (form.money1.value >= 30) && (form.money1.value < 50)) {
form.money2.value=2450;
form.sum.value = parseInt(form.money1.value) * parseInt(form.money2.value);
return;
} else if ( (form.money1.value >= 50) && (form.money1.value < 100)) {
form.money2.value=2400;
form.sum.value = parseInt(form.money1.value) * parseInt(form.money2.value);
return;
} else if ( (form.money1.value >= 100) && (form.money1.value < 200)) {
form.money2.value=2300;
form.sum.value = parseInt(form.money1.value) * parseInt(form.money2.value);
return;
} else if (form.money1.value >= 200) {
form.money2.value=2200;
form.sum.value = parseInt(form.money1.value) * parseInt(form.money2.value);
return;
;
}
}
</script><table>
<form name=form>
<tr><td align=right>1개↑</td><td align=right>: 3,500원</td></tr><tr><td align=right>5개↑</td><td align=right>: 2,800원</td></tr><tr><td align=right>10개↑</td><td align=right>: 2,500원</td></tr><tr><td align=right>30개↑</td><td align=right>: 2,450원</td></tr><tr><td align=right>50개↑</td><td align=right>: 2,400원</td></tr><tr><td align=right>100개↑</td><td align=right>: 2,300원</td></tr><tr><td align=right>200개↑</td><td align=right>: 2,200원</td></tr></table>
</td>
<input type=hidden name=heung value=on>
<td width=170>
<b>※ 왼쪽 단가표를 참고하여<br> 수량을 기재하십시오.</b><br>
수 량 : <input type=text onkeyup=ChkForm(this.form) onchange=ChkForm(this.form) name=money1 size=13 style="text-align:right;border-width:1pt; border-color:rgb(204,204,204); border-style:solid;"> 개<br>
단 가 : <input type=text name=money2 size=13 readonly style="text-align:right;border-width:0pt; border-color:white;color:blue;"> 원<br>
금 액 : <input type=text size=11 name=sum readonly style="text-align:right;border-width:0pt; border-color:white;font-weight:bold; color:red;"> 원<br>
<input type=submit value=장바구니넣기>
</td>
</tr></form>
</table>