<script language="javascript">
function setUniproUsernameValue(sel){
alert('etUniproUsernameValu!');
var  xel = window.showform.searchkey.value;
if(sel == "1")
{
if (xel ==''|| xel == "请输入员工姓名" || xel == "请输入员工编号"){
window.showform.searchkey.value = "请输入员工姓名";
window.showform.searchkey.focus();
//return true;
}
} if(sel == "2" )
{
if (xel =='' || xel == "请输入员工编号" || xel == "请输入员工姓名")
{
window.showform.searchkey.value = "请输入员工编号";
window.showform.searchkey.focus();
//return true;
}
}

}
function query_submit(){
alert('query_submit!!!');
var ProNo = window.showform.searchkey.value;
if (ProNo == "" || ProNo == "请输入员工姓名" || ProNo=="请输入员工编号"){
alert("请输入查询条件");
return false;
}

return true;

}function shy_clear(){
alert('shy_clear!!!');
if(window.showform.searchkey.value == "请输入员工姓名" ||window.showform.searchkey.value == "请输入员编号") 
window.showform.query.value='';
}
</script>
<form id="showform" name="showform" method="post" action="#"  onsubmit="javascript:return query_submit();">
 <table width="758" height="83" border="0" align="center" cellspacing="1">
         <tr>
           <th width="92" scope="col"><a href="#"></a></th>
           <th colspan="5" scope="col"><table width="511" border="0">
             <tr>
               <td>&nbsp; &nbsp;
                
                 <input name="searchkey" type="text" id="searchkey" size="22" onfoucs="javascript:shy_clear();" >&nbsp;
  <select name="select" id="select" onChang="javascript:setUniproUsernameValue(this.value);">
                   <option value="0" selected>请选择查询条件</option>
   <option value="1" >员工姓名</option>
   <option value="2">员工编号</option>
                 </select>
                 &nbsp;
                 <input type="submit" name="query" value="查询">                 <a href="#"></a></td>
             </tr>
           </table></form>

解决方案 »

  1.   

    我的问题:::我点按姓名查询,对应的text框却没有出现"请输入姓名",这是为何,以上代码供大家帮我调试.谢谢各位拉
      

  2.   

    <select name="select" id="select"onChange="javascript:setUniproUsernameValue(this.value);">
    <option value="0" selected>请选择查询条件</option>
    <option value="1" >员工姓名</option>
    <option value="2">员工编号</option>
    </select>
    少了一个e
    onChange is not onChang