Saturday, February 27, 2010

How to set text in search bar that will clear when you click in the area?

text like ';serach...'; or ';Enter a book title...'; in a search bar..


example like the search bar Yahoo have above .. with the word ';Search in the bar that will disappear when you click the area.





how do i achieve that?How to set text in search bar that will clear when you click in the area?
that's an easy one.





%26lt;form method=';post'; action=';';%26gt;


%26lt;textarea name=';comments'; cols=';40'; rows=';5';%26gt;


Enter the text you want to be shown here.


%26lt;/textarea%26gt;%26lt;br%26gt;


%26lt;input type=';submit'; value=';Submit'; /%26gt;


%26lt;/form%26gt;How to set text in search bar that will clear when you click in the area?
get focuslistener of the text area. when the focuslistener is activated, then do something like textarea object.clear();





Ram (www.openletters.in)

No comments:

Post a Comment