onchange event is not woking
- by Jim
Hello guys, Whats wrong with this code? My first function working fine but second function is not working. Please help me. Thanks
function bag1()
{
var sum = 0;
var qty = document.form1.qty.value;
var pack = document.form1.pack.value;
document.form1.bag.value = (qty*pack)/100;
}
function bag2()
{
var sum = 0;
var qty = document.form1.qty.value;
var pack1 = document.form1.pack1.value;
document.form1.bag1.value = (qty*pack1)/100;
}
Here is HTML code
<input id="item1" name="item1" type="text" maxlength="255" value=""/>
<input type="text" maxlength="255" value=""/>
<input id="weight" name="weight" type="text" maxlength="255" value=""/>
<input id="pack" name="pack" type="text" maxlength="255" onchange="bag1();" value=""/>
<input id="bag" name="bag" type="text" maxlength="255" value=""/>
<input id="rate" name="rate" type="text" maxlength="255" value=""/>
<input id="amount" name="amount" type="text" maxlength="255" value=""/>
<input id="element_12" name="type" type="text" maxlength="255" value=""/>
<input id="element_13" name="brand" type="text" maxlength="255" value=""/>
<!-------------------------- Caculating 2th Row --------------------------------------------------------------->
<input type="text" maxlength="255" value=""/>
<input type="text" maxlength="255" value=""/>
<input id="weight2" name="weight2" type="text" maxlength="255" value=""/>
<input id="pack2" name="pack2" type="text" maxlength="255" value=""/>
<input id="bag2" name="bag2" type="text" maxlength="255" onchange="bag2();" value=""/>
<input id="rate2" name="rate2" type="text" maxlength="255" value=""/>
<input id="amount2" name="amount2" type="text" maxlength="255" value=""/>
<input id="element_12" name="type" type="text" maxlength="255" value=""/>
<input id="element_13" name="brand" type="text" maxlength="255" value=""/>
</form type="submit" value="calculator2">