I am going to ask you a childish question about JavaScript. I asked you this question because I am beginner in JavaScript. I hope you will give me solution.
When I place the above code, it will show me following result:Code:<!DOCTYPE html> <html> <body> <p>Click the button to calculate x.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { y=5; z=2; x=y+z; document.getElementById("demo").innerHTML=x; } </script> </body> </html>
Untitled.png
If I press button "try it" it will show me a result 7.
Now I want to know that how can I input different values of y and z and get value of x by using javascript code?
Please give me an example.


Reply With Quote
Bookmarks