帝国cms 判断搜索字段的字段不能为空?
2018-12-05 站长 站长日志
<!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> </td> <td> <input type="submit" name="Submit" value="马上搜索"> <font color="#666666">(不设置为不限)</font> </td> </tr> </table> </form> </body> </html> |