简体   繁体   English

单击表单后如何清除文本

[英]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 用这样的js

<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:>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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