I need to allow user to enter value at only one box at a time.
For eg: if user enter months the days field should not allow him to enter value.
Can I disable the other field if user enter value in any of them ?
Also it only takes numbers.
Here is my html
<td class="ctext" width="13%"> Reset Frequency in Months/Days
</td>
<td class="ctext" style="display:inline-block">
<label for="frMnth" style="display:block">Month</label>
<input type="text" class="textfield" value="" id="frMnth" name="frMnth" onkeypress="return isNumber(event)" />
<label for="frDays" style="display:block">Days</label>
<input type="text" class="textfield" value="" id="frDays" name="frDays" onkeypress="return isNumber(event)" />
</td>
And this is script to type number only using Onkeypress.
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;}
Can I disable the field using Onkeypress ?