<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>index.html</title> </head> <body> <input type="text" id="test" value="xxx@xxx.com" style="color: gray;" onkeypress="this.style.color='black';" /> <hr /> 点击input默认值消失 <br /> input: <br /> <input name="textfield" type="text" value="点击添入标题" style="color: gray;" onfocus="if (value =='点击添入标题'){value =''}" onblur="if (value ==''){value='点击添入标题'}" /> <br /> textarea: <br /> <textarea name="textarea" cols="80" rows="17" onfocus="if(value=='正文:'){value=''}" onblur="if (value ==''){value='正文:'}"></textarea> </body> </html>
?