4
Answers

sum values should be shown in textbox using javascript

Ravi gaddam

Ravi gaddam

11y
1.7k
1
Hi guys,

how to sum hidden input values with the help of clicking buttons.and summation value should be shown in textbox for each and every button click.you can understand by running this html source.

<html lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Marks Allotment Form</title>
 <STYLE type="text/css">
input[type=text] {
-background: white;
border: 3px  #FF0000;
border-radius: 5px;
-box-shadow: 0 0 5px #7ACC52;
color: #000066;
background-color: #D3D8DC;
padding: 5px 10px;
outline: none;
}
 </style>
 <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
</head>
<body>

<form name='marksallotment1' onSubmit="return formValidation();">

<table border="0">
<tr></tr>
<tr>
<td>i.</td><td></td><td></td><td></td><td>
<input type="hidden" value="0" id="10">
<input type="button" id="first1" style="height:30px; width:50px" value="0">
</td><td></td><td></td><td>
<input type="hidden" value="2" id="12">
<input type="button" id="first2" style="height:30px; width:50px" value="2"></td>
</tr>
<tr>
<td>ii.</td><td></td><td></td><td></td><td>
<input type="hidden" value="0" id="20">
<input type="button" id="second1" style="height:30px; width:50px" value="0">
</td><td></td><td></td><td>
<input type="hidden" value="2" id="22">
<input type="button" id="second2" style="height:30px; width:50px" value="2"></td>
</tr>
<tr>
<td>iii.</td><td></td><td></td><td></td><td>
<input type="hidden" value="0" id="30">
<input type="button" id="third1" style="height:30px; width:50px" value="0">
</td><td></td><td></td><td>
<input type="hidden" value="2" id="32">
<input type="button" id="third2" style="height:30px; width:50px" value="2"></td>
</tr></table>
<table>
<br/>
<tr><td>Total : <input type="text" size="5" value="" id="total"></td></tr>
</table>
</form>

</body>
</html>




Thanks
Ravi Gaddam
Answers (4)