1. Open the page, and the input box automatically obtains the focus.
2. You enter keywords. If this is the first input, the default Value is automatically cleared.
<! Doctype html public "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml" lang = "gb2312"> <pead> <title> Code: search input box </title> <meta http-equiv = "content-type" content = "text/html; charset = gb2312 "/> <meta name =" author "content =" fengyan, http://www.cnlei.com "> <meta name =" keywords "content =" automatically get focus, automatically clear the default Value "/> <meta name =" description "content =" when the page is opened, the input box automatically obtains the focus. The user enters a keyword. If this is the first input, the default Value "/> <style type =" text/css "media =" all "> is automatically cleared. firstInp {color: #999 ;}. doindium {color: # f60 ;}</style> </pead> <body onload = "document. serchform. k. focus (); "> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]