Today, 26.12.11, is the third day of the Javascript tutorial here on quadd help. And this is final day of Javascript tutorials on quadd.
Day 3
Controlling Forms using Javascript
Today we will learn how to read values from form text boxes and process them. In this process our yesterday's topic of functions will be very useful. And reading of form elements is very important to create interactive webpages and moreover it defines the real purpose of using forms on websites that is to pass values to the server which user entered in the form elements. And before sending information to the server the values entered into the form elements must be read. So will do today:
Example Code:
Calculator example:
So readers, this is end of our Javascript for X tutorials. Hope you found it useful. For any help and queries on this, please comment on the respective tutorial.
Yesterday's topic: Javascript Functions
24.12.11 topic: Javascript Popup Boxes
Day 3
Controlling Forms using Javascript
Today we will learn how to read values from form text boxes and process them. In this process our yesterday's topic of functions will be very useful. And reading of form elements is very important to create interactive webpages and moreover it defines the real purpose of using forms on websites that is to pass values to the server which user entered in the form elements. And before sending information to the server the values entered into the form elements must be read. So will do today:
- Reading values from form's text box (To simplify things at this level, we will learn to read text boxes only).
Example Code:
Output 1: User entered value to the text box |
After clicking form button - Submit - program reads value of text box and shows it on alert dialog box. |
Output1: Your own Calculator |
Output2: User Enter values and press "+" button. |
Output3: User Enter values and press "-" button. |
Output4: User Enter values and press "*" button. |
Output5: User Enter values and press "/" button. |
Yesterday's topic: Javascript Functions
24.12.11 topic: Javascript Popup Boxes
I am not clear about--"x.fname.value"
ReplyDeletesuppose 'x' as your form name and then read this syntax
ReplyDeleteformname.fieldname.fieldvalue
this means x.fname.value can be read as
get the value of fname field which is in 'x' form.
And your form in body section is known as 'x' in function (in head section_.
When i made the calculator..it's not showing the result.As i enter 1(first no.) then again 1(2nd no.) and then the button (+,-,*,/-any1).No result!
ReplyDeletesir its not working....
ReplyDeleteThe code you see above is running well without any flaws on at least 20 computers so far. Please check your code, Raman, before making this 'not working' statement publicly.
ReplyDeleteAnd next time please report with faulty code and output.
sorry! actually the code that i made was wrong ...
ReplyDeleteThank you Raman! for feedback!
ReplyDelete