很简单的 onblur onfocus方法示例

来源:互联网 发布:mac设置桌面图标 编辑:程序博客网 时间:2024/06/07 13:31
<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 </head>
 <body>

  <input type='text' id='txt_q' name='q' class='SERACH' value='hello world' 

  onblur="(this.value=='')?this.value='hello world':this.value" 

  onfocus="if(this.value=='hello world'){this.value='';};this.select();"/>
  <br/>
 </body>
</html>