这个是js
1 <script type="text/javascript">
2 function checkForm(){
3 var section = document.getElementById('section').value;
4 var page = document.getElementById('page').value;
5 if (section==""){
6 alert("请输入章节");
7 return false;
8 }
9 else if(page==""){
10 alert("请输入页码");
11 return false;
12 }
13 myform.submit();
14 }
15 </script>
这个是表单
1 <form name="myform" action="searchBySectionAndPage.do" mothd="post">
2 <table>
3 <tr>
4 <td>
5 章节
6 </td>
7 <td>
8 <input type="text" name="section">
9 </td>
10 </tr>
11 <tr>
12 <td>
13 页码
14 </td>
15 <td>
16 <input type="text" name="page">
17 </td>
18 </tr>
19 <tr>
20 <td>
21 <input type="reset" value="重置">
22 </td>
23 <td>
24 <input type="button" value="确定" onclick="return checkForm();">
25 </td>
26 </tr>
27 </table>
28 </form>
js很让我头痛,备注一下.