`
hexx1986
  • 浏览: 23237 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类

鼠标点击文本框后,里面的文字就消失或全选中

阅读更多
<!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=utf-8" />
<title>鼠标点击文本框后,里面的文字就消失或全选中</title>
</head>
<body>
鼠标点击文字消失:<input name="textfield" style="color:#CCC;" type="text" value="点击文字消失" size="12" onclick="value='';focus()" />
<br/> <br/>
鼠标点击文字选中:<input name="textfield" type="text" value="点击文字选中" size="12" onclick="focus();select()" />
<br/><br/>
<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