683Chapter 23Text-Related Form ObjectsThe right-hand side of the (Web hosting domain)

683Chapter 23Text-Related Form ObjectsThe right-hand side of the assignment expression extracts the current contents of the fieldand (with the help of the toUpperCase()method of the string object) converts the originalstring to all uppercase letters. The result of this operation is assigned to the valuepropertyof the field. The application of the thiskeyword in the previous examples may be confusing at first, butthese examples represent the range of ways in which you can use such references effectively. Using thisby itself as a parameter to an object s event handler refers only to that singleobject a text object in Listing 23-3. If you want to pass along a broader scope of objects thatcontain the current object, use the thiskeyword along with the outer object layer that youwant. In Listing 23-2, I sent a reference to the entire form along by specifying this.form meaning the form that contains this object, which is being defined in the line of HTML code. At the other end of the scale, you can use similar-looking syntax to specify a particular prop- erty of the thisobject. Thus, in the last example, I zeroed in on just the valueproperty ofthe current object being defined this.value. Although the formats of this.formandthis.valueappear the same, the fact that one is a reference to an object and the other just avalue can influence the way your functions work. When you pass a reference to an object, thefunction can read and modify properties of that object (as well as invoke its functions); butwhen the parameter passed to a function is just a property value, you cannot modify thatvalue without building a complete reference to the object and its value. Related Items:form.defaultValueproperty. Methodsblur() Returns:Nothing. Compatibility:WinIE3+, MacIE3+, NN2+, Moz1+, Safari1+ Just as a camera lens blurs when it goes out of focus, a text object blurs when it losesfocus when someone clicks or tabs out of the field. Under script control, blur()deselectswhatever may be selected in the field, and the text insertion pointer leaves the field. Thepointer does not proceed to the next field in tabbing order, as it does if you perform a blur bytabbing out of the field manually. The following statement invokes the blur()method on a text box named vanishText: document.forms[0].vanishText.blur(); Related Items:focus()method; onblurevent handler. focus() Returns:Nothing. Compatibility:WinIE3+, MacIE3+, NN2+, Moz1+, Safari1+ For a text object, having focus means that the text insertion pointer is flashing in that textobject s field (having focus means something different for buttons in a Windows environ- ment). Giving a field focus is like opening it up for human editing. Setting the focus of a field containing text does not let you place the cursor at any specifiedlocation in the field. The cursor usually appears at the beginning of the text (although inWinIE4+, you can use the TextRangeobject to position the cursor wherever you want in thefield, as shown in Chapter 35 on the CD-ROM). To prepare a field for entry to remove theexisting text, use both the focus()and select()methods. document.formObject.textObject.focus()
We recommend high quality webhost to host and run your jsp application: christian web host services.

Leave a Reply