DarryBoy
04-22-2003, 06:53 PM
I need to return the value that is calculated in the following script to a currency format (all credit to Jona). Please show me.
<html><head>
<script>
function calc(){
var chkd;
var count = 0;
if(document.qtyFrm.c1.checked){chkd=document.qtyFrm.c1.value; count=count+1;}
if(document.qtyFrm.c2.checked){chkd=document.qtyFrm.c2.value; count=count+1;}
if(count==2){alert("Check only one, please."); return false;}
document.qtyFrm.qtyTotal.value=parseInt(document.qtyFrm.qty.value)*chkd;
}
</script>
</head><body>
<form name="qtyFrm">
<input type=text name="qty" onKeyPress="calc()">
<br>
130: <input type=checkbox name="c1" value="130" onclick="return calc()"><br>
1300: <input type=checkbox name="c2" value="1300" onclick="return calc()"><br>
<input type=text name="qtyTotal">
</form></body></html>
Kind regards
Darryn
<html><head>
<script>
function calc(){
var chkd;
var count = 0;
if(document.qtyFrm.c1.checked){chkd=document.qtyFrm.c1.value; count=count+1;}
if(document.qtyFrm.c2.checked){chkd=document.qtyFrm.c2.value; count=count+1;}
if(count==2){alert("Check only one, please."); return false;}
document.qtyFrm.qtyTotal.value=parseInt(document.qtyFrm.qty.value)*chkd;
}
</script>
</head><body>
<form name="qtyFrm">
<input type=text name="qty" onKeyPress="calc()">
<br>
130: <input type=checkbox name="c1" value="130" onclick="return calc()"><br>
1300: <input type=checkbox name="c2" value="1300" onclick="return calc()"><br>
<input type=text name="qtyTotal">
</form></body></html>
Kind regards
Darryn