Javascript examples for DOM HTML Element:Input Text
Do calculation based on value input from form
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function change(){/* w ww .j a v a 2 s . c o m*/ var textBox =parseInt(document.getElementById('myTextField').value) var sec=textBox*(textBox+1)/2 console.log(sec); } </script> </head> <body> <input type="text" id="myTextField"> <input type="button" id="byBtn" value="Change" onclick="change()"> </body> </html>