我想在js中调用一个排序的方法,来对传递来的数组进行排序,该怎样调用,小弟不很懂,但很喜欢问各位大虾!谢谢咯! 
<%@   page     contentType="text/html;   charset=gb2312"%>   
<html>       
    <head>       
    <meta   http-equiv="Content-Type"   content="text/html;charset=gb2312"> 
        <link   rel="stylesheet"   href="red.css"   type="text/css"/>       
    <title> vvv </title>       
    </head>       
    <body> 
  <form   name="frm1"   method="post"   action=""   > 
            <div   style="width:130px;   float:left"   id="bb">   
      <input   type="text"   id="txt1"   value=""   style="width:   37px"> <input       type="button"   id="btn"   onclick="add()"   value="添加">       
      <br>       
      <select   size="10"   id="select1"     style="width:   100px">       
      </select> <br> 
      <input   type="checkbox"   name="check"> 逆排序 </div> 
    </form> 
    <form   name="frm2"> 
      <div   id="bb"> 
      <select   size="10"   id="select2"   style="width:10%"> 
        <option   value="1"> 直接插入排序 </option> 
        <option   value="2"> 快速排序 </option> 
        <option   value="3"> 选择排序 </option> 
        <option   value="4"> 递归排序 </option> 
        </select> 
          <input       type="button"   id="btn1"     value="排序"   onclick="getNumber()"> </div>   
            </div> 
          </form>     
    <script   language="javascript">   
          function   add()       
                {   
                      if(frm1.txt1.value!="") 
                          {     
                            frm1.select1.options[frm1.select1.options.length]   =   new   Option(frm1.txt1.value,frm1.txt1.value);   
                          }else{ 
                                    document.getElementById("tmp").innerHTML="值为空,请输入值!"; 
                                        return   false; 
                                      } 
                      if(isNaN(frm1.txt1.value)) 
                            { 
                                document.getElementById("tmp").innerHTML="输入非法字符,请重新输入!"; 
                                      return   false;         
                                  }     
                    } 
  
  function   getNumber() 
        { 
    var   sel1   =   document.getElementById("select1");//将列表里的数组放到数组中 
    var   optionlength   =   sel1.options.length; 
    var   a=new   Array(optionlength); 
              for(var   i   =   0   ;i   <   optionlength   ;i++) 
                          { 
                              a[i]   =   sel1.options[i].value; 
                                } 
                  for(var   j=0;j <a.length;j++) 
                              {                               document.getElementById("tmp").innerHTML+=a[j]+",";                                     } 
            
  function   insertSort(var   array[]) 
      { 
            var   n   =   array.length; 
            for(var   i   =   1;   i   <   n;   i++) 
            insert(array,   i   -   1,   array[i]);                     } 
              function   insert(var   array[],   var   i,var   x) 
                  { 
                    while(   i   > =   0   &&   x   <   array[i]) 
                        { 
                          array[i   +   1]   =   array[i]; 
                          i--; 
                              } 
                            array[i   +   1]   =   x; 
                    }       } 
  
                                                    
              
          
      </script> 
    <div   id="tmp"> </div>   
    </body>             
    </html>