解决方法:
为了解释清楚,这里提供两种展现形式,第二种实现标题所述效果。
第一种,左击提示文字消失(右击不起作用)的效果。
<table border="0" cellspacing="0" cellpadding="0" style="line-height: 20px">
<form method="get" action="http://www.xxx.gov.cn/jsearch/index.jsp" target="_blank" name="qForm">
<tbody>
<tr>
<td width="145"><input id="q" οnblur="if(this.value==""){this.value="请您输入关键字"}" οnclick="if(this.value=="请您输入关键字"){this.value="";this.focus();}" style="padding-left: 5px; width: 140px; color: #909090" name="q" value="请您输入关键字" type="text" /> <input type="hidden" name="pagemode" value="result" /><input type="hidden" name="style" value="1" /><input type="hidden" name="appid" value="1" /><input type="hidden" name="ck" value="0" /><input id="pos" type="hidden" name="pos" value="title,content" /><input type="hidden" name="colgroup" value="1,2,3,4,5" /></td>
<td width="61"><input src="http://www.xxx.gov.cn/picture/0/101029152324256.gif" type="image" name="imageField" /></td>
</tr>
</tbody>
</form>
</table>
第二种,即标题所说效果,鼠标滑过,里面提示文字消失效果。(该代码较全,下拉具有四个选项。最后一个是搜特定栏目,包括该栏目下的子栏目)
<SCRIPT language=javascript>
function changeurl(id)
{
if (id=="znjs")
{document.getElementById("znjs").style.display='block';
document.getElementById("zqjs").style.display='none';
document.getElementById("xxgk").style.display='none';
document.getElementById("bsfw").style.display='none';
}
if (id=="zqjs")
{document.getElementById("znjs").style.display='none';
document.getElementById("zqjs").style.display='block';
document.getElementById("xxgk").style.display='none';
document.getElementById("bsfw").style.display='none'; }
if (id=="xxgk")
{document.getElementById("znjs").style.display='none';
document.getElementById("zqjs").style.display='none';
document.getElementById("xxgk").style.display='block';
document.getElementById("bsfw").style.display='none'; }
if (id=="bsfw")
{document.getElementById("znjs").style.display='none';
document.getElementById("zqjs").style.display='none';
document.getElementById("xxgk").style.display='none';
document.getElementById("bsfw").style.display='block'; }
}
</SCRIPT>
<script>function OnEnter( field ) { if( field.value == field.defaultValue ) { field.value = ""; } }function OnExit( field ) { if( field.value == "" ) { field.value = field.defaultValue; } }</script>
<div style="height:23px;width:100%;white-space:nowrap;overflow:hidden">
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><select name="select" id="select" onChange="changeurl(this.options[this.selectedIndex].value);" style="height:23px;color:#616161;line-height:20px;">
<option value="znjs" selected="selected">站内检索</option>
<option value="zqjs">站群检索</option>
<option value="xxgk">信息公开</option>
<option value="bsfw">办事服务(某个栏目)</option>
</select></td>
<td valign="top">
<div id="znjs" style="display:block">
<form method="get" action="http://www.xxx.gov.cn/jsearch/index.jsp" target="_blank" name="qForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style=" padding-left:4px" nowrap><input id="search_field_@A" onMouseOut="this.blur(); OnExit(this)" onMouseOver="this.focus(); OnEnter(this)" style="border: #add6ff 1px solid;line-height:20px;height:19px;width:130px;padding-left:8px;color:#616161;font-size:12px;" name="q" value="请您输入检索关键字" type="text" />
<INPUT type=hidden value='result' name='pagemode'/>
<INPUT type=hidden value='1' name='appid'/>
<INPUT type=hidden value='1' name='style'/>
<INPUT type=hidden value='o' name='ck'/>
<INPUT type=hidden value='1' name='webid'/>
<input type="hidden" id="pos" name="pos" value="title,content"></td>
<td style="padding-left:5px"><input src="/picture/562/ycjy_12-18-top_05.jpg" type="image" name="imageField" width="49" height="23" /></td>
<td style="padding-left:4px"><a href="http://www.xxx.gov.cn/jsearch/index.jsp?pagemode=advsearch&appid=1&style=1" target="_blank"><img src="/picture/562/ycjy_12-18-top_07.jpg" alt="" width="70" height="23" border="0" /></a></td>
</tr>
</table>
</form>
</div>
<div id="zqjs" style="display:none">
<form method="get" action="http://www.xxx.gov.cn/jsearch/index.jsp" target="_blank" name="qForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style=" padding-left:4px" nowrap><input id="search_field_@A" onMouseOut="this.blur(); OnExit(this)" onMouseOver="this.focus(); OnEnter(this)" style="border: #add6ff 1px solid;line-height:20px;height:19px;width:130px;padding-left:8px;color:#616161;font-size:12px;" name="q" value="请您输入检索关键字" type="text" />
<INPUT type=hidden value='result' name='pagemode'/>
<INPUT type=hidden value='1' name='appid'/>
<INPUT type=hidden value='1' name='style'/>
<INPUT type=hidden value='o' name='ck'/>
<INPUT type=hidden value='' name='webid'/>
<input type="hidden" id="pos" name="pos" value="title,content"></td>
<td style="padding-left:5px"><input src="/picture/562/ycjy_12-18-top_05.jpg" type="image" name="imageField" width="49" height="23" /></td>
<td style="padding-left:4px"><a href="http://www.xxx.gov.cn/jsearch/index.jsp?pagemode=advsearch&appid=1&style=1" target="_blank"><img src="/picture/562/ycjy_12-18-top_07.jpg" alt="" width="70" height="23" border="0" /></a></td>
</tr>
</table>
</form>
</div>
<div id="xxgk" style="display:none">
<form method="get" action="http://www.xxx.gov.cn/jsearch/index.jsp" target="_blank" name="qForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style=" padding-left:4px" nowrap><input id="search_field_@A" onMouseOut="this.blur(); OnExit(this)" onMouseOver="this.focus(); OnEnter(this)" style="border: #add6ff 1px solid;line-height:20px;height:19px;width:130px;padding-left:8px;color:#616161;font-size:12px;" name="q" value="请您输入检索关键字" type="text" />
<INPUT type=hidden value='result' name='pagemode'/>
<INPUT type=hidden value='21' name='appid'/>
<INPUT type=hidden value='41' name='style'/>
<INPUT type=hidden value='o' name='ck'/>
<INPUT type=hidden value='' name='webid'/>
<input type="hidden" id="pos" name="pos" value="title,content"></td>
<td style="padding-left:5px"><input src="/picture/562/ycjy_12-18-top_05.jpg" type="image" name="imageField" width="49" height="23" /></td>
<td style="padding-left:4px"><a href="http://www.xxx.gov.cn/jsearch/index.jsp?pagemode=advsearch&appid=1&style=1" target="_blank"><img src="/picture/562/ycjy_12-18-top_07.jpg" alt="" width="70" height="23" border="0" /></a></td>
</tr>
</table>
</form>
</div>
<div id="bsfw" style="display:none">
<form method="get" action="http://www.xxx.gov.cn/jsearch/index.jsp" target="_blank" name="qForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style=" padding-left:4px" nowrap><input id="search_field_@A" onMouseOut="this.blur(); OnExit(this)" onMouseOver="this.focus(); OnEnter(this)" style="border: #add6ff 1px solid;line-height:20px;height:19px;width:130px;padding-left:8px;color:#616161;font-size:12px;" name="q" value="请您输入检索关键字" type="text" />
<INPUT type=hidden value='result' name='pagemode'/>
<INPUT type=hidden value='22' name='appid'/>
<INPUT type=hidden value='22' name='style'/>
<INPUT type=hidden value='o' name='ck'/>
<input type="hidden" id="pos" name="pos" value="title,content">
<input type="hidden" name="colgroup" value="1,2,3,4,5" /></td>
<td style="padding-left:5px"><input src="/picture/562/ycjy_12-18-top_05.jpg" type="image" name="imageField" width="49" height="23" /></td>
<td style="padding-left:4px"><a href="http://www.xxx.gov.cn/jsearch/index.jsp?pagemode=advsearch&appid=1&style=1" target="_blank"><img src="/picture/562/ycjy_12-18-top_07.jpg" alt="" width="70" height="23" border="0" /></a></td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</div>