Event Handlers/Methods/Properties | Description |
onBlur | Called when the text box loses the focus. |
onChange | Called when the text box loses the focus and has had its value modified. |
onFocus | when the text box receives the focus. |
onSelect | when a user selects some of the text within the text box. |
blur() | Removes the focus from the text box. |
focus() | Gives the focus to the text box. |
handleEvent() | Invokes the handler for the event specified and was added in JavaScript 1.2. |
select() | Selects the text in the text box. |
defaultValue | Returns the value of this text box specified by the VALUE attribute. Note that this property is not supported by the Opera browsers. |
form | Returns the entire form the text box is in. |
name | Returns the name of this text box specified by the NAME attribute. |
type | Returns the type of this text box specified by the TYPE attribute. |
value | Returns the value that is actually displayed in the text box. |
<html> <head> <script language="JavaScript"> <!-- function openWin(){ var myInstance = document.myForm.myText; var myWin = open("", "","width=450,height=200"); myWin.document.write("The defaultValue is: " + myInstance.defaultValue); myWin.document.write("<br>"); myWin.document.write("The name is: " + myInstance.name + "<br>"); myWin.document.write("The type is: " + myInstance.type + "<br>"); myWin.document.write("The value is: " + myInstance.value + "<br>"); myWin.document.write(myInstance.form.myButton.value); myWin.document.close(); } --> </script> </head> <body> <form name="myForm"> <input type=TEXT value="hello world" name="myText"> <input type=BUTTON value="Click to Process" name="myButton" onClick="openWin()"> </form> </body> </html>
10.14.Text Object | ||||
10.14.1. | Text | |||
10.14.2. | Text.blur() | |||
10.14.3. | Text.defaultValue | |||
10.14.4. | Text.focus() | |||
10.14.5. | Text.form | |||
10.14.6. | Text.name | |||
10.14.7. | Text.onBlur | |||
10.14.8. | Text.onFocus | |||
10.14.9. | Text.onSelect | |||
10.14.10. | Text.select() | |||
10.14.11. | Text.type | |||
10.14.12. | Text.value |