This is a sample of the code I have on my page. It works well, except it will not automatically update when the quantity changes. I want to have an onblur on the quantity to run the function again, but it’s not letting me. I know the form thing is a little messy, but that’s how my page is right now. Can someone tell me what “onblur” to write in the quantity box to update the totals? Thanks.
<html> <head> <title></title>
<script language=”JavaScript” type=”text/javascript”>
function DoSilk(x){
if (1<=x && x<=20) y=(0.0524*x*x)+(32.04575);
if (20<x && x<=50) y=39.779
if (50<x && x<=288) y=(10.4835 * Math.pow(x, -0.121635))+.2;
if (288<x && x<=4200) y=(10.4835
if (4200<x) y=4;
}
function DoHeat(x){
if (1<=x && x<=100) y=(10.87*Math.pow(x,-.17))+1.03;
if (100<x) y=6;
}
function Radio(obj){
y=’?’;
x=document.forms.formjunk.product_options_amountzz.value;
rbs=obj.getElementsByTagName(‘INPUT’);
if (rbs[0].checked){
DoSilk(x);
}
if (rbs[1].checked){
DoHeat(x);
}
if (rbs[2].checked){
y=4;
}
document.getElementById(‘price’).value=y;
document.forms.orderform_16180.subtotal.value = (document.forms.orderform_16180.price.value
}
</script>
</head> <body>
<P>Quantity</P>
<FORM name=”formjunk” method=”post” action=””>
<INPUT type=”text” name=”product_options_amountzz”>
</form>
<P>
<FORM name=”form15″ method=”post” action=””>
<span id=”radioFred” onclick=”Radio(this);” >
Silk Screen<input type=”radio” name=”radiotype”> <br>
Heat Transfer<input type=”radio” name=”radiotype”><br>
Blank<input type=”radio” name=”radiotype”> <br>
</span>
</form>
<FORM name=”orderform_16180″ method=”post” action=””>
Price Per<input id=”price” size=”10″> <br>subtotal<input id=”subtotal” size=”10″>
</FORM>
</body> </html>