fucction check1(){
应为
function check1(){

解决方案 »

  1.   

    String[] CateCode;
    应为
       var CateCode=[];
       for(int i=0;i<2;i++){
    应为
       for(var i=0;i<2;i++){
      

  2.   

    好多错误,帮你修正调试如下
    <html>
    <head>
    <title>
    CategoryEmail
    </title>
    </head>
    <body>
    <script language=javascript>
    function checkAll(){
       if(document.form1.checkboxAll.checked ==true){
         check1();
         check2();
        }
    }
    function check1(){
       document.form1.checkbox1.checked =true;
    }
    function check2(){
       document.form1.checkbox2.checked =true;
    }function getCateCode( ){
       var CateCode=[];
         if(document.form1.checkbox1.checked==true)
                   CateCode[0] = "A001";
          if(document.form1.checkbox2.checked==true)
                   CateCode[1] = "A002";
          for(var i=0;i<2;i++){
            if(CateCode[i]!=null){
               window.prompt("CateCode[i] is "+CateCode[i]);
             }
           }
        return CateCode;
       }  function subDelectAll(){
           getCateCode();
           document.form1.submit();
      }</script>
    <h1>
     THIS IS MY TEST!
    </h1>
    <form name="form1" method="post" action="Jsp2.jsp">
    <table  border="1" width="80%"  cellpadding="0" cellspacing="0" >
     <table  border="1" width="80" >
      <tr >
       <td width="70%">
         <input type="checkbox" name="checkboxAll" onclick="checkAll()">Check All
       </td>
      <td width="30%">
        <input type="submit" name="DelectAll"   value ="DelectAll" onclick="subDelectAll()">
      </tr>
      </table>
      <table border="1" width="80%" cellpadding="0" cellspacing="0">
       <tr bgcolor ="yellow">    <td width="4%">&nbsp; </td>
        <td width="16%">    <div align="center">CategoryCode</div>
        </td>    <td width="80%">
          <div align="left">Description</div>
        </td>  </tr>
      <tr border="1"  width="100%"  cellpadding="0" cellspacing="0" >
        <td width="4%">
          <input type="checkbox" name="checkbox1" value="checkbox1"  onclick="check1()">
        </td>
        <td align="center" width="16%">AOO1</td>
        <td align="left" width="80%" class="FontUnderLine">America </td>
      </tr>
      <tr>
        <td width="4%">
          <input type="checkbox" name="checkbox2" value="checkbox2" onclick="check2()">
        </td>
        <td align="center" width="16%">A002</td>
        <td align="left" width="80%" class="FontUnderLine">Europe</td>
      </tr>
     </table>
    </table>
    </form>
    </body>
    </html>1.选完不能撤销不选
    2.prompt有什么用?
      

  3.   

    <html>
    <head>
    <title>
    CategoryEmail
    </title>
    </head>
    <body>
    <script language="javascript">
    function checkAll(){
       if(document.form1.checkAllbox.checked){
         check1();
         check2();
        }
        else
        {
        document.form1.checkbox1.checked =false;
        document.form1.checkbox2.checked =false;
        }
    }
    function check1(){
       document.form1.checkbox1.checked =true;
    }
    function check2(){
       document.form1.checkbox2.checked =true;
    }function getCateCode(){
       var CateCode = new Array("","");
         if(document.form1.checkbox1.checked==true)
                   CateCode[0] = "A001";
          if(document.form1.checkbox2.checked==true)
                   CateCode[1] = "A002";
          for(var i=0;i<2;i++){
            if(CateCode[i]!=null){
               window.prompt("CateCode[i] is "+CateCode[i]);
             }
           }
        return CateCode;
       }  function subDelectAll(){
           getCateCode();
           document.form1.submit();
      }</script>
    <h1>
     THIS IS MY TEST!
    </h1>
    <form name="form1" method="post" action="Jsp2.jsp">
    <table  border="1" width="80%"  cellpadding="0" cellspacing="0" >
      <tr >
       <td width="70%">
         <input type="checkbox" name="checkAllbox" onclick="checkAll()">Check All
       </td>
      <td width="30%">
        <input type="submit" name="DelectAll" value="DelectAll" onclick="subDelectAll()">
      </tr>
      </table>
      <table border="1" width="80%" cellpadding="0" cellspacing="0">
       <tr bgcolor ="yellow">    <td width="4%">&nbsp; </td>
        <td width="16%">    <div align="center">CategoryCode</div>
        </td>    <td width="80%">
          <div align="left">Description</div>
        </td>  </tr>
      <tr border="1"  width="100%"  cellpadding="0" cellspacing="0" >
        <td width="4%">
          <input type="checkbox" name="checkbox1" value="checkbox1"  onclick="check1()">
        </td>
        <td align="center" width="16%">AOO1</td>
        <td align="left" width="80%" class="FontUnderLine">America </td>
      </tr>
      <tr>
        <td width="4%">
          <input type="checkbox" name="checkbox2" value="checkbox2" onclick="check2()">
        </td>
        <td align="center" width="16%">A002</td>
        <td align="left" width="80%" class="FontUnderLine">Europe</td>
      </tr>
     </table>
    </form>
    </body>
    </html>
      

  4.   

    见笑了,本人实在是太马虎了:1)用prompt只是想用做提示的做用,看我到底有没得到参数;2)有什么办法能撤消不选?
      

  5.   

    2. 去掉onclick="check1()",onclick="check2()"即可
    <html>
    <head>
    <title>
    CategoryEmail
    </title>
    </head>
    <body>
    <script language=javascript>
    function checkAll(){
       if(document.form1.checkboxAll.checked ==true){
         check1();
         check2();
        }
    }
    function check1(){
       document.form1.checkbox1.checked =true;
    }
    function check2(){
       document.form1.checkbox2.checked =true;
    }function getCateCode( ){
       var CateCode=[];
         if(document.form1.checkbox1.checked==true)
                   CateCode[0] = "A001";
          if(document.form1.checkbox2.checked==true)
                   CateCode[1] = "A002";
          for(var i=0;i<2;i++){
            if(CateCode[i]!=null){
               window.prompt("CateCode[i] is "+CateCode[i]);
             }
           }
        return CateCode;
       }  function subDelectAll(){
           getCateCode();
           document.form1.submit();
      }</script>
    <h1>
     THIS IS MY TEST!
    </h1>
    <form name="form1" method="post" action="Jsp2.jsp">
    <table  border="1" width="80%"  cellpadding="0" cellspacing="0" >
     <table  border="1" width="80" >
      <tr >
       <td width="70%">
         <input type="checkbox" name="checkboxAll" onclick="checkAll()">Check All
       </td>
      <td width="30%">
        <input type="submit" name="DelectAll"   value ="DelectAll" onclick="subDelectAll()">
      </tr>
      </table>
      <table border="1" width="80%" cellpadding="0" cellspacing="0">
       <tr bgcolor ="yellow">    <td width="4%">&nbsp; </td>
        <td width="16%">    <div align="center">CategoryCode</div>
        </td>    <td width="80%">
          <div align="left">Description</div>
        </td>  </tr>
      <tr border="1"  width="100%"  cellpadding="0" cellspacing="0" >
        <td width="4%">
          <input type="checkbox" name="checkbox1" value="checkbox1">
        </td>
        <td align="center" width="16%">AOO1</td>
        <td align="left" width="80%" class="FontUnderLine">America </td>
      </tr>
      <tr>
        <td width="4%">
          <input type="checkbox" name="checkbox2" value="checkbox2" >
        </td>
        <td align="center" width="16%">A002</td>
        <td align="left" width="80%" class="FontUnderLine">Europe</td>
      </tr>
     </table>
    </table>
    </form>
    </body>
    </html>
      

  6.   

    谢谢了! 
      功能是实现了,可为什么我第二次点击Check All时,下面两个小方框的√还在,应该是也谁之取消的才对呀!有没有改进的方法!
      

  7.   

    function checkAll(){
       var flag=document.form1.checkboxAll.checked
       document.form1.checkbox1.checked =flag;
       document.form1.checkbox1.checked =flag;
    }
      

  8.   

    to: net_lover 
     你的程序是非常正确的,但也是在我第二次点击[]Check All时,下面两个[√]Check1和[√]Check2里的√也是还在呀。