Forms are very useful for grabbing information using the sub-directory or hierarchy style of finding a value (document.form.input.value)
Let me show you some forms and inputs and how they are used.
<INPUT TYPE="text" NAME="alerttext" SIZE="10">
The above code would make an input like the one below.
Kind of cool right? Want to know how i did that?
Well to start off i used the object hierarchy to grab the information you write in the textbox then store it in the alert box.
To do that look at the code below:
var alertytext = document.Formname.alerttext.value;
The above code does this:
First we create a form and call it Formname so that we can refer to it later. Then inside the form we put a textbox and a button (which we have already gone over). We give them a name also so that we can refer to them within the form. We give the button an action, onClick, so when it is clicked a function is ran. Then we create a function called alerty() and make its specifications:
1. We create a variable called alertytext and tell it to equal: The value of alerttext (which is the textbox), and to find it look inside the form, formname, and to find the form look inside the document, which we currently have one of.
2. Then we tell the function to alert us of the variable alertytext, which currently holds the value of whatever you have written inside the textbox.
That is it for this lesson on FORMS, head on over to the next lesson when your ready.
Join our Website's Jester Forum today!
Its FREE and easy......
Status: SITE OPENED
Enjoy the STAY
If you enjoyed this page,
add 2 favorites or tell a friend