Previous Example-|-Next Chapter's Example-|-Return to Chapter Listing

Example 17.10:
Communicating Through Textareas

Fill in the form, and press Tab to move from box to box. See the textarea at the bottom for instructions:
First Name:
Last Name:
Address:
City:
State/Province/Region:
Zip/Postal Code:
Country:

See the instructions here:


This is the script we used. In the HEAD... <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- var s1 = "Type your last name here." var s2 = "Type your street address." var s3 = "Your city name, please." var s4 = "Yes, yes, you know--state, province, etc." var s5 = "Okay, zip or postal code." var s6 = "Yep, now your country." //--> </SCRIPT> Then this form: <FORM> First Name: <input type="text" size="30"><BR> Last Name: <input type="text" size="30" onfocus="elements[7].value = s1 "><BR> Address: <input type="text" size="30" onfocus="elements[7].value = s2 "><BR> City: <input type="text" size="30" onfocus="elements[7].value = s3 "><BR> State/Province/Region: <input type="text" size="30" onfocus="elements[7].value = s4 "><BR> Zip/Postal Code: <input type="text" size="30" onfocus="elements[7].value = s5 "><BR> Country: <input type="text" size="30" onfocus="elements[7].value = s6 "><P> <B>See the instructions here:</B><BR> <TEXTAREA COLS="40" ROWS="2">Type your first name in the text box.</TEXTAREA> </FORM> Also, at the bottom of the form we moved focus to the first text box with this: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- document.forms[0].elements[0].focus() //--> </SCRIPT>
Previous Example-|-Next Chapter's Example-|-Return to Chapter Listing