`
hh792000
  • 浏览: 16812 次
  • 性别: Icon_minigender_1
  • 来自: 通渭
社区版块
存档分类

鼠标点击文本框后,里面的文字就消失,鼠标离开文本框后,里面的文字又会显示

    博客分类:
  • html
阅读更多
今天么事干浏览网页,看到这段代码,就粘贴过来了。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                                 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> 
    <title>鼠标点击文本框后,里面的文字就消失,鼠标离开文本框后,里面的文字又会显示</title> 
  </head> 
  <body> 
    <input name="key" type="text" id="key" value="关键词" size="30" 
           onmouseover=this.focus();this.select();
           onclick="if(value==defaultValue){value='';this.style.color='#000'}" 
           onBlur="if(!value){value=defaultValue;this.style.color='#999'}" style="color:#999" />
  </body> 
</html> 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics