1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4.  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  5.  <meta http-equiv="Content-Language" content="zh-CN" /> 
  6.  <title></title> 
  7.  <style type="text/css"> 
  8.  /*<![CDATA[*/  
  9.   .black{color:#000;}  
  10.   .gray{color:#666;}  
  11.  /*]]>*/  
  12.  </style> 
  13. </head> 
  14. <body> 
  15. <form method="post" action=""> 
  16.  <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'}" /> 
  17. </form> 
  18. </body> 
  19. </html>