Fire-House 58

Events

onselect

e-7


JavaScript:
firehouse58.com onselect event handlers execute script when the value within a text or textarea object is selected.

Hard Reload
To See Menu

select the text in these form fields

    

 

event handler onselect

 


<textarea rows="2" name="SelectMe" cols="20"
onSelect ="this.value = this.value.toUpperCase()"
wrap="physical">onselect demo see me get
bigger!</textarea>

<input type="text" name="SelectMe" size="20"
value="i just got bigger" onSelect="this.value =
this.value.toUpperCase()">


Not much to this. No script. The event handler onSelect simply uses the method toUpperCase() to change the appearance of the text inside the form fields.



 
 
 


method

select()


focus then blur from this field

 


To draw attention to a form element, the select() method might be more appropriate.

 


<textarea rows="4" name="sel" cols="20" wrap="physical" onBlur="this.select(); return true;">demo of select() method,
used to draw attention to a form element</textarea>

 

 


This form element uses the onBlur event handler to invoke the select() method.

 

This event handler can be used with the text and textarea objects. It falls into the same family as onFocus and onBlur. I have yet to find many functional uses for onSelect, if you think of one, let me know.


[back]   [home]   [next]