Code 1:
Explaination:
- document.getElementById("") returns the tag with that id
- pa is a variable which holds the tag object
- pa.value returns the value of the tag object.
- alert() shows messege box(used to check if it returns the correct input value for debug)
- onclick() is a function which is called when the button is clicked
- run() is a user made custom fuction
Another way: Code 2
Explaination:
- login is the form object name that can be used directly. You can name the Form tag with any name.
- login.username is the input text object that is inside that form tag
- login.username.value can also be used directly without storing into the variable.
No comments:
Post a Comment