给文本框添加灰色提示文字

上一篇 / 下一篇  2010-04-18 17:19:24 / 个人分类:Web开发

<html>
<head>
<title>给文本框添加灰色提示文字</title>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<input type="text" id="key" name="key" value="请输入关键词" onFocus="if(value==defaultValue){value='';this.style.color='#000'}" onBlur="if(!value){value=defaultValue;this.style.color='#999'}" style="color:#999999">
</body>
</html>

TAG:

 

评分:0

我来说两句

Open Toolbar