简体   繁体   中英

How to get rid of text after clicking in the form

I have a guestbook form with this code:

<input class='tbox' type='text' value='Type here' name='code_verify' size='15' maxlength='20'>

How can I get rid of the text after clicking at the "type here" box?

What i mean is when I click in the field "type here" the words "type here" must dissapear and give a blinking cursor.

Any help would be appreciated.

Thanks

With js like this

<input class='tbox' type='text' value='Type here' name='code_verify' 
size='15' maxlength='20' onfocus="if (this.value == 'Type here') { this.value=''}">
<input class="tbox" type="text" 
onfocus="if (this.value==this.defaultValue) this.value=''"  
onblur="if (this.value=='') this.value=this.defaultValue"  
value="Type here" name="code_verify" size="15" maxlength="20:>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM