onFocus="if (this.value==this.defaultValue) this.value='';" onBlur="if (this.value=='') this.value=this.defaultValue;"



例子:


<form name=fmsearch action="search.asp" method=post>




<INPUT TYPE="text" NAME="keywords" size="13" maxlength="20" value="搜索商品" alt="请填写要搜索的商品的关键词"




style="BORDER-RIGHT: #CCCCCC 1px solid; BORDER-TOP: #CCCCCC 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #CCCCCC 1px solid; COLOR: #666666; BORDER-BOTTOM: #CCCCCC 1px solid;FONT-FAMILY: verdana"

onFocus="if (this.value==this.defaultValue) this.value='';"

onBlur="if (this.value=='') this.value=this.defaultValue;">

<input type=image src="images/search.gif" border=0 name="search" align=top alt="<p align=left>请在左边的文本框中填入商品关键词<br>再点击“搜索”按</p>">

</form>