input文本框初始状态是灰色文本,当得到焦点就情况文本,失去焦点恢复到初始状态
?function OnEnter( field )
???? {
????? if( field.value == field.defaultValue )
????? {
??????? field.value = "";
????? }
???? }
??? function OnExit( field )
??? { if( field.value == "" )
???? {
??????? field.value = field.defaultValue;
????? }
??? }
??? function changeColor(field)
??? {
??????? field.style.color='black';
??? }
?
<input class='fontColor' name="min_price" type="text" id="min_price"? value="最低价" size="5" maxlength="18" onFocus=OnEnter(this) onBlur=OnExit(this) onkeyUp=changeColor(this)>