<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Write The Codes By Myself</title>
<style type="text/css">
<!--
.style8 {color: #FF0000}
-->
</style>
<script language="javascript">function checkvalue(theform)

   
   for(j=0;j<theform.checkbox.length;j++)
   if(theform.checkbox[j].checked==true)
   {
  break;
    }
   for(i=0;i<theform.radiobutton.length;i++)
   if (theform.radiobutton[i].checked==true)
   {
    break;
    }
if (i==theform.radiobutton.length && j==theform.checkbox.length)
{
   alert("您没选择任何查询项目");
   return false;
}
return (true);
}
</script></head><body>
<table width="75%"  border="0" align="center">
  <tr>
    <td height="27" class="style4"><div align="center">书目查询</div></td>
  </tr>
</table>
<table width="75%"  border="0" align="center">
  <tr>
    <td><span class="style1"></span>在这里,您可以对</span><span class="style8">本馆图书</span>进行分类及详细查询</td>
  </tr>
</table>
<form name="form1" method="post" action="ac_booksearch.asp" onsubmit="javascript:return checkvalue(this);">
  <table width="68%" height="232"  border="0" align="center">
    <tr>
      <td colspan="2" ><span class="style6">1.请选择查询路径</span></td>
    </tr>
    <tr >
      <td width="15%"></td>
      <td width="85%" ><input name="radiobutton" type="radio" value="1">        
      <span class="style7">编号</span>
        <span class="style7"><input name="booknum" type="text" id="booknum">
        </span></td>
    </tr>
    <tr>
      <td></td>
      <td ><input type="radio" name="radiobutton" value="2">        
        <span class="style7">书名
        <input name="bookname" type="text" id="bookname">
        </span></td>
    </tr>
    <tr >
      <td>&nbsp;</td>
      <td class="style7"><input type="checkbox" name="checkbox" value="4">        
        <span class="style7">内容
        <input name="content" type="text" id="content">
        <input type="checkbox" name="checkbox" value="5">        
        作者
        </span>
        <input name="author" type="text" id="writer"></td>
    </tr>
    <tr>
      <td></td>
      <td ><input type="radio" name="radiobutton" value="3">
        <span class="style7"> 书籍分类
        <select name="bookclass" id="bookclass">
          <option value="1" selected>马列主义、毛泽东思想、邓小平理论</option>
          <option value="2">社会科学</option>
          <option value="3">自然科学</option>
          <option value="4">法律、哲学</option>
        </select>
      </span></td>
    </tr>
    <tr>
      <td><span class="style6">2.出版时间</span></td>
      <td><input name="starttime" type="text" id="starttime">
        <span class="style7">
        年--</span>
        <input name="endtime" type="text" id="endtime">
        <span class="style7">年 (可不填)</span> </td>
    </tr>
    <tr>
      <td class="style6">3.每页显示条数</td>
      <td><span class="style7"><select name="rcperpage" class="style7" id="rcperpage">
        <option value="5">5</option>
        <option value="10">10</option>
        <option value="15">15</option>
      </select>
        条</span></td>
    </tr>
    <tr>
      <td height="21">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr align="center">
      <td height="42" colspan="2"><input type="submit" name="submit" value="查询" > &nbsp;&nbsp;&nbsp;
      <input type="reset" name="reset" value="重填"></td>
    </tr>
  </table>
</form>
</body>
</html>

解决方案 »

  1.   

    又出问题了~能再帮看下吗?我要实现无论单选还是多选只要选中一个就提交成功~
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>书籍查询</title><link href="css/yangshi.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    .style8 {color: #FF0000}
    -->
    </style>
    <script language="javascript">
    function checkvalue(theform)

       var objck=document.getElementsByName("checkbox");
       var objra=document.getElementsByName("radiobutton");
       for(j=0;j<objck.length;j++)
       if(objck[j].checked==true)
       {
        //alert("aa")  作为测试
        break;         好象这里没有执行啊~~有一个复选选中可是没有跳出,继续执行下面的单选
       }               判断~~晕了~
       for(i=0;i<objra.length;i++)
       if (objra[i].checked==true)
       {
       break;
        }
      if (i==objra.length)// && j==theform.checkbox.length
      {
         alert("您没选择任何查询项目");
         return false;
      }
      return (true);
    }
    </script>
    <!--#include file="top.asp"--><table width="75%"  border="0" align="center">
      <tr>
        <td height="27" class="style4"><div align="center">书目查询</div></td>
      </tr>
    </table>
    <table width="75%"  border="0" align="center">
      <tr>
        <td><span class="style1"></span>在这里,您可以对</span><span class="style8">本馆图书</span>进行分类及详细查询</td>
      </tr>
    </table>
    <form name="form1" method="post" action="ac_booksearch.asp" onsubmit="javascript:return checkvalue(this);" >
      <table width="68%" height="232"  border="0" align="center">            <!--onSubmit="return checkvalue()不对的-->
        <tr>
          <td colspan="2" ><span class="style6">1.请选择查询路径</span></td>
        </tr>
        <tr >
          <td width="15%"></td>
          <td width="85%" ><input name="radiobutton" type="radio" value="1">        
          <span class="style7">编号</span>
            <span class="style7"><input name="booknum" type="text" id="booknum">
            </span></td>
        </tr>
        <tr>
          <td></td>
          <td ><input type="radio" name="radiobutton" value="2">        
            <span class="style7">书名
            <input name="bookname" type="text" id="bookname">
            </span></td>
        </tr>
        <tr >
          <td>&nbsp;</td>
          <td class="style7"><input type="checkbox" name="checkbox" value="4">        
            <span class="style7">内容
            <input name="content" type="text" id="content">
            <input type="checkbox" name="checkbox" value="5">        
            作者
            </span>
            <input name="author" type="text" id="writer"></td>
        </tr>
        <tr>
          <td></td>
          <td ><input type="radio" name="radiobutton" value="3">
            <span class="style7"> 书籍分类
            <select name="bookclass" id="bookclass">
              <option value="1" selected>马列主义、毛泽东思想、邓小平理论</option>
              <option value="2">社会科学</option>
              <option value="3">自然科学</option>
              <option value="4">法律、哲学</option>
            </select>
          </span></td>
        </tr>
        <tr>
          <td><span class="style6">2.出版时间</span></td>
          <td><input name="starttime" type="text" id="starttime">
            <span class="style7">
            年--</span>
            <input name="endtime" type="text" id="endtime">
            <span class="style7">年 (可不填)</span> </td>
        </tr>
        <tr>
          <td class="style6">3.每页显示条数</td>
          <td><span class="style7"><select name="rcperpage" class="style7" id="rcperpage">
            <option value="5">5</option>
            <option value="10">10</option>
            <option value="15">15</option>
          </select>
            条</span></td>
        </tr>
        <tr>
          <td height="21">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr align="center">
          <td height="42" colspan="2"><input type="submit" name="submit" value="查询" > &nbsp;&nbsp;&nbsp;
          <input type="reset" name="reset" value="重填"></td>            <!--onClick="javascript:checkvalue(this.form)"-->
        </tr>
      </table>
    </form>拜托高手帮忙看下吧~谢谢了~