Html program for counting button click
<html>
<head>
<title>EVM</title>
<script type="text/javascript">
var p=0;
var q=0;
var r=0;
var s=0;
function a()
{
p=p+1;
}
function b()
{
r=r+1;
}
function c()
{
q=q+1;
}
function d()
{
s=s+1;
}
function total()
{
document.f1.fie1.value=p;
document.f1.fie2.value=r;
document.f1.fie3.value=q;
document.f1.fie4.value=s;
}
function rst()
{
p=0;
q=0;
r=0;
s=0;
}
</script>
</head>
<form name="f1">
<body>
<input type="button" value="TDP" style="background-color:yellow" onClick="return a()">
<br>
<input type="button" value="YSR" style="background-color:blue" onClick="return b()">
<br>
<input type="button" value="Congress" style="background-color:red" onClick="return c()">
<br>
<input type="button" value="JSA" style="background-color:green" onclick="return d()">
<br>
TDP <input type="text" name="fie1">
<br>
YSR <input type="text" name="fie2">
<br>
Congress <input type="text" name="fie3">
<br>
JSA <input type="text" name="fie4">
<br>
<input type="button" value="total" onClick="return total()">
<input type="reset" value="reset" onClick="return rst()">
</form>
</body>
</html>
Output:
<html>
<head>
<title>EVM</title>
<script type="text/javascript">
var p=0;
var q=0;
var r=0;
var s=0;
function a()
{
p=p+1;
}
function b()
{
r=r+1;
}
function c()
{
q=q+1;
}
function d()
{
s=s+1;
}
function total()
{
document.f1.fie1.value=p;
document.f1.fie2.value=r;
document.f1.fie3.value=q;
document.f1.fie4.value=s;
}
function rst()
{
p=0;
q=0;
r=0;
s=0;
}
</script>
</head>
<form name="f1">
<body>
<input type="button" value="TDP" style="background-color:yellow" onClick="return a()">
<br>
<input type="button" value="YSR" style="background-color:blue" onClick="return b()">
<br>
<input type="button" value="Congress" style="background-color:red" onClick="return c()">
<br>
<input type="button" value="JSA" style="background-color:green" onclick="return d()">
<br>
TDP <input type="text" name="fie1">
<br>
YSR <input type="text" name="fie2">
<br>
Congress <input type="text" name="fie3">
<br>
JSA <input type="text" name="fie4">
<br>
<input type="button" value="total" onClick="return total()">
<input type="reset" value="reset" onClick="return rst()">
</form>
</body>
</html>
Output: