很简单的 onblur onfocus方法示例

<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>
posted on 2012-11-06 15:59  YangJin  阅读(159)  评论(0编辑  收藏  举报