产品使用及交流论坛

首页 » 产品使用交流区 » 安装及使用交流 » 怎么在搜索表单提交搜索按钮时如果字符为空弹出警告?
异度人生 - 2013/8/6 18:13:28
1.怎么在搜索表单提交搜索按钮时如果字符为空弹出警告?2.搜索时如果没有匹配项还是会出来空白页,怎么让这个空白页也能弹出提示无结果或是无此信息之类的提示呢?
代码如下:
<form action="/e/search/" target="zdy_search" method="get" name="S_feedback">
    <div style="background:url(/e/upload/s1/fck/image/2013-08/chaxun.png)center center no-repeat; no-repeat 0 0">
    <div style="text-align: center;"><br />
    <br />
    <br />
    <br />
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 姓&nbsp;&nbsp; 名:<input type="text" maxlength="50" value="" id="pa_truename" name="pa_truename" class="tb" /><br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     查询码:<input type="text" maxlength="50" value="" id="code" name="code" class="tb" /><br />
    <!--以上html代码可根据需要删除和修改-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="hidden" value="113" name="modelid" /><input type="hidden" value="1" name="siteid" /><input type="submit" value=" 查询 " class="bt" /><br />
    <br />
    <br />
    </div>
    </div>
</form>
xiyou - 2013/8/7 9:51:19
submit按钮加一个点击事件,如<input type="submit" value=" 查询 " class="bt"  onclick="return checkempty()"/>
然后自己写一个js函数来判断checkempty()
<script type="text/javascript">
function checkempty()
{
if(document.getElementById("pa_truename").value=="")
{
  alert(”请填写姓名");
  return false;
}
}
</script>
1
查看完整版本: 怎么在搜索表单提交搜索按钮时如果字符为空弹出警告?