Adult web hosting - 682Part IIIDocument Objects ReferenceListing 23-2(continued) function upperMe(form) {

682Part IIIDocument Objects ReferenceListing 23-2(continued) function upperMe(form) { inputStr = form.converter.value; form.converter.value = inputStr.toUpperCase(); }

Enter lowercase letters for conversion to uppercase:

I also show two other ways to accomplish the same task, each one more efficient than theprevious example. Both utilize the shortcut object reference to get at the heart of the textobject. Listing 23-3 passes the text object contained in the thisreference to the functionhandler. Because that text object contains a complete reference to it (out of sight, but therejust the same), you can access the valueproperty of that object and assign a string to thatobject s valueproperty in a simple assignment statement. Listing 23-3:Passing a Text Object (as this) to the Function

Enter lowercase letters for conversion to uppercase:

Yet another way is to deal with the field values directly in an embedded event handler instead of calling an external function (which is easier to maintain because all scripts aregrouped together in the Head). With the function removed from the document, the event han- dler attribute of the tag changes to do all the work: document.formObject.textObject.value
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.

Leave a Reply