HTML and CSS Reference
In-Depth Information
An HTML form called form1 is started.
The input type for this form is a textbox that will hold up to 60 characters.
The name of the textbox is yourname .
The second input type is also a textbox.
The name of this textbox is message .
The onClick event handler is triggered when the user clicks inside this textbox. It
concatenates the message “ Greetings and Salutations ” to whatever was typed in the
first box, and assigns that value to this textbox, called message .
To clear all the boxes, the user can click the Reset button. See Figures 11.27 and
Figure 11.27 The user enters his or her name in the first text field.
Figure 11.28 When the user clicks in the second textbox, a message appears.
The password Object. The password object is much like the text object except that
the input does not appear as text, but as asterisks or bullets, depending on the browser.
The idea is to prevent a snoopy onlooker from seeing what is being typed in the box, but
this is hardly a safe or secure type of password. If you look at the source of the HTML
document, anywhere the actual password is spelled out, it appears in plain text for the
viewer of the source.
The password object parallels the HTML password field <input type=“password”> and
also has name and value fields. To reference a text field from JavaScript, you go down
the document tree, starting at the document , the form , and then the text element. To get
a value in the text field, for example, you would use document.form1.passwd.value , where
form1 is the name of the form and passwd is the name of the password field. Figure 11.29
shows the JavaScript object hierarchy for the password object. Tables 11.11 and 11.12
show properties and methods of the password object.
Search WWH ::

Custom Search