效果图:
代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>input 提示</title> </head> <body> <input type="text" style="color: rgb(153, 153, 153);" value="请输入用户名" onfocus="if(value=='请输入用户名') {value='';}this.style.color='#000';" onblur="if (value=='') {value='请输入用户名';this.style.color='#999';}"> </body> </html>