Here is My code
<form name="formA">
<input type="text" name="iptA" id="iptA" value="" />
<input type="button" name="btnA" id="btnA" value="Click Here" onclick="count();"/>
<input type="button" name="btnClr" id="btnClr" value="Clear" onclick="clear();"/>
</form>
<script type="text/javascript" charset="utf-8">
var a = 0;
document.formA.iptA.value = a;
function count(){
a++;
document.formA.iptA.value = a;
}
function clear(){
a = 0;
document.formA.iptA.value = a;
}
</script>
In this, the function count()
is working properly but the second function clear()
is not working.
Thanks in advance