I am a newbie and i am trying to make a calculator using JS, I have seen online tutorials which show how to make a caluculator which actually looks like a calculator (like on in MS windows) , but i dont want to make that as i am not able to understand that script. i wanna make a simpler or as it may seem to you, more 'complicated' calculator, in which there are two input fields, in which user enters two numbers he desires to calculate, and chooses mathematical operator to apply to those 2 numbers, if you are not getting it, form is simply ready: http://peeyush.tk/Eucli.html
. and when user clicks submit button, it would launch a function which will get numbers entered in textboxes, assign it to variables, lets say x and y, get the operator user selected and do the calculation and show the result, but The Main Problem Is I Don't Know How To Get The Values User Has Entered In The Form And Submitted And Assign It To Variables So I Can Mathematically Operate Them....
If you did not get the assigning to variable part, here is how it'd work:
x + y = sum
document.getElementById("result").innerHTML = sum ;
Code Explained: Function will start when submit button is clicked, first it will get user entered value from textbox1 and assign it to x (i dont know how to do it) then it will get user entered value from textbox2 and assign it to y ( dont know how to do it) , then it will ad them, and display sum in a predefined space.
I hope i have made myself clear, if you still have any doubts please ask me, thanks for help and taking time to read all this.