perform addition of output values and send mutiple values of same textfield to next page

i have the following code in which i want to add output values(value3) and show it in any other form output and also i want to pass each and every value entered of textfield(value2) to next page using whatever to fetch the values in next page. The value of count could range from 1 to anything between 10.

code is

<html>
<head>
<title>Arithmetic operations</title>
</head>
<script type="text/javascript">
function Multiplication(o1, o2, o3){
	var x,y,z;
	x=o1.value;
	y=o2.value;
	z=x*y;
	o3.value=z
}
function calcForm(formNode){
	Multiplication(formNode.value1, formNode.value2, formNode.value3);
}
</script>
</head>
<body>
<div style="display:none">
<form name="calc">
	<h1>Online Calculator</h1>
	Enter first Numeric Value :   
	<input
	   id="value1"
	   type       = "text" 
	   onchange   = "calcForm(this.parentNode)"
	   onkeypress = "this.onchange();"
	   onpaste    = "this.onchange();"
	   oninput    = "this.onchange();"
	   onloadstart     ="this.onchange();"
	   
	   value	  =	"5"
	/> 
	 </br>
	Enter Second Numeric Value : 

	<input
	   id="value2"
	   type       = "text" 
	   onchange   = "calcForm(this.parentNode)"
	   onloadstart= "this.onchange();"
	   onkeypress = "this.onchange();"
	   onpaste    = "this.onchange();"
	   oninput    = "this.onchange();"
	   value	  =	"1"
	/>	
	 </br>
	 </br>
	Result of the Arithmetic operation is : <output type="number" id="value3"> </output></br>
	</form>
</div>

<div id="i_container">
</div>

<script>
	count = 4;
	my_parent = document.getElementById('i_container');
	for(i=0; i<count; i++){
		nw = calc.cloneNode(true);
		nw.name = "dynamic_name_"+i;
		nw.id = "dynamic_id_"+i;
		my_parent.appendChild(nw);
	}
	for(i=0; i<count; i++){
		p = document.getElementById("dynamic_id_"+i);
		calcForm(p);
	}
</script>

</body>
</html>


Source: jsp

Leave a Reply