- <!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" />
- <meta http-equiv="Content-Language" content="zh-CN" />
- <title></title>
- <style type="text/css">
- /*<![CDATA[*/
- .black{color:#000;}
- .gray{color:#666;}
- /*]]>*/
- </style>
- </head>
- <body>
- <form method="post" action="">
- <input type="text" name="" id="" value="初始值" class="gray" onclick="if(this.value=='初始值'){this.value='';this.className='black'}" onblur="if(this.value=='') {this.value='初始值';this.className='gray'}" />
- </form>
- </body>
- </html>
转载于:https://blog.51cto.com/phpmylove/685814