Home  • Programming • JavaScript

How to work with DOM using JavaScript?

3024 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>
Copyright © 2024. Powered by Intellect Software Ltd