HTML is so simple that most of the things are self explanatory. I will only give you a brief explanation here. The text boxes are created by a type = "text" attribute, while clickable button by type = "button" attribute. In addition to this, we also give a name to almost every form element. In the last example, the names given to the two text boxes are userName and userEmail respectively. You can choose any name you like. We have already seen that an onClick event occurs when somebody clicks a button. We will make use of one other event onSubmit in our discussion. Let's now combine HTML forms with if conditions to do form processing. But first, you need to know how to pass values to functions.
The copyright of the article
Handling HTML Forms - Part I in
JavaScript is owned by Muhammad Ali Shah. Permission to republish
Handling HTML Forms - Part I in print or online must be granted by the author in writing.