Posts

Showing posts from February, 2020

Get value from form using JavaScript.

Image
Using Text and Button object in HTML. Get  value from form using JavaScript. In this example we  create a form in which two object Text and Button, as first Text object is used to accept a mathematical expression for evaluation and second Object button is used to calculate the entered expression. When we Click this Button it Calculate the expression in shown in next Text box.                                       In script tags we create a function as named calculate in which we pass the form as argument/ reference of form.In block of function we simply use form.result.value=eval(form.entry.value) , where result and entry is name of  text object and eval is a method that is use  to convert the string expression to a numeric value. when this program is executed in a JavaScript is enabled browser,Enter an expression in the first Text object  on the form for evaluation and click the calculate button. when the button is clicked on its click event is fires, and activate Jav