帝国cms 判断搜索字段的字段不能为空?

<!doctype html>

<html>

<head>

<meta charset="UTF-8">

<title>Untitled Document</title>

</head>

<body>

<script>

function CheckSearchForm(){

        if(document.getElementById("searchform").stitle.value=="")

        {

                alert("请输入标题");

                return false;

        }

        if(document.getElementById("searchform").swriter.value=="")

        {

                alert("请输入作者");

                return false;

        }

        return true;

}

</script>

<form name="searchform" id="searchform" method="post" action="/e/search/index.php" onsubmit="return CheckSearchForm();">

  <table width="550" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">

    <input type="hidden" name="tbname" value="zhengshu">

    <input type="hidden" name="tempid" value="1">

    <input type="hidden" name="andor" value="and">

    <tr class="header">

      <td colspan="2">新闻搜索</td>

    </tr>

    <tr bgcolor="#FFFFFF">

      <td width="97">姓名:</td>

      <td width="388">

          <input type="hidden" name="show[]" value="title">

          <input type="hidden" name="hh[]" value="LK">

          <input name="keyboard[]" type="text" id="stitle">

      </td>

    </tr>

    <tr bgcolor="#FFFFFF">

      <td>编号:</td>

      <td>

          <input type="hidden" name="show[]" value="xingming">

          <input type="hidden" name="hh[]" value="LK">

          <input name="keyboard[]" type="text" id="swriter">

      </td>

    </tr>

        <tr bgcolor="#FFFFFF">

      <td>&nbsp;</td>

      <td>

        <input type="submit" name="Submit" value="马上搜索">

        <font color="#666666">(不设置为不限)</font>

      </td>

    </tr>

  </table>

</form>

</body>

</html>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 第一部分 HTML&CSS整理答案 1. 什么是HTML5? 答:HTML5是最新的HTML标准。 注意:讲述HT...
    kismetajun阅读 27,695评论 1 45
  • 工厂模式类似于现实生活中的工厂可以产生大量相似的商品,去做同样的事情,实现同样的效果;这时候需要使用工厂模式。简单...
    舟渔行舟阅读 7,827评论 2 17
  • 单例模式 适用场景:可能会在场景中使用到对象,但只有一个实例,加载时并不主动创建,需要时才创建 最常见的单例模式,...
    Obeing阅读 2,102评论 1 10
  • 马丁·塞利格曼在《真实的幸福》这本书里提出,幸福由积极情绪、投入和意义三个元素决定,侧重于感觉上的幸福,而《持续的...
    倚倾城阅读 1,274评论 2 3
  • 最让人猝不及防的雨,是乡下的午后阵雨。 午间一片艳阳高照,钢筋水泥组成的世界白晃晃一片,就连到不足五十米远的小超市...
    阿畔阅读 325评论 5 4