Automatically getting percentage based on two input fields in javascript -
i new java.can tell how calculate percentage of 2 input numbers.will have write javascript? can suggest?
here code
<td class="bg1" style="width:22%;"><input type="text" style="width:40px;" name="score2" align="center" maxlength="4" onblur="validatefield('digit1',this)" />/<input type="text" style="width:40px;" name="totmarks2" align="center" maxlength="4" onblur="validatefield('digit1',this)"/></td> <td class="bg2" width="15%;"><input type="text" name="percentage2" maxlength="5" /></td>
java
, javascript
not same. , yes, need write javascript
this, e.g.:
var score = document.getelementsbyname("score2")[0].value; var totalmarks = document.getelementsbyname("totmarks2")[0].value; var percentage = (score/totalmarks)*100; document.getelementsbyname("percentage2")[0].value = percentage;
Comments
Post a Comment