How to work with DOM using JavaScript?
![[media=3024] 3024](/media/image/standard/3024.jpg)
You can read value from text box (input tag) and can process values to produce output. And then print output to text box. see the following example:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example1</title>
</head>
<body>
<form action="#" name="frmExample1">
X: <input type="text" value="0" name="txtX" onKeyUp="frmExample1.txtOutput.value=parseInt(frmExample1.txtX.value)+parseInt(frmExample1.txtY.value)"><br>
Y: <input type="text" value="0" name="txtY" onKeyUp="frmExample1.txtOutput.value=parseInt(frmExample1.txtX.value)+parseInt(frmExample1.txtY.value)"><br>
Output<input type="text" value="0" name="txtOutput">
</form>
</body>
</html>
Comments 2