你重新写一下数组吧,没有人这么定义数组的!
var Arrayname= new Array();
Arrayname[0]=""
Arrayname[1]=""
.....
Arrayname[n]=""
这样会好点.

解决方案 »

  1.   

    oh boy, the way you define those categories sure looks ugly, use XML island next time
      

  2.   

    agree with flylyke(), after you reorganize the array definition, I am sure the problem will go away
      

  3.   

    grand_subcategory_array和grand_subcategory_id_array的数据问题,改为
    var  grand_subcategory_array  =  new  Array(new  Array(new  Array('选择品牌')),new  Array(new  Array('选择品牌'),new  Array('选择品牌','中国长城计算机'),new  Array('选择品牌','迈克龙'),new  Array('选择品牌','美达电子'),new  Array('选择品牌','艾尔莎'),new  Array('选择品牌','雅马哈'),new  Array('选择品牌','美达电子'),new  Array('选择品牌','北京华旗'),new  Array('选择品牌','索尼'),new  Array('选择品牌','超微'),new  Array('选择品牌','超微'),new  Array('选择品牌','北京华旗')),new  Array(new  Array('选择品牌'),new  Array('选择品牌','实达电脑')),new  Array(new  Array('选择品牌'),new  Array('选择品牌','三星')),new  Array(new  Array('选择品牌'),new  Array('选择品牌','其他厂商')));
      var  grand_subcategory_id_array  =  new  Array(new  Array(new  Array(0)),new  Array(new  Array(0),new  Array(0,'2'),new  Array(0,'9'),new  Array(0,'4'),new  Array(0,'39'),new  Array(0,'1'),new  Array(0,'57'),new  Array(0,'60'),new  Array(0,'16'),new  Array(0,'56'),new  Array(0,'36'),new  Array(0,'15')),new  Array(new  Array(0),new  Array(0,'14')),new  Array(new  Array(0),new  Array(0,'28')),new  Array(new  Array(0),new  Array(0,'26')));
      

  4.   

    here is my implementation based on XML island, 你可以参考一下:1. col2.xml:
    <categories>
    <category name="配件" value="1">
    <subcategory name="硬盘" value="2">
    <grand_subcategory name="中国长城计算机" value="2"/>
    </subcategory>
    <subcategory name="内存" value="3">
    <grand_subcategory name="迈克龙" value="9"/>
    </subcategory>
    <subcategory name="主板" value="5">
    <grand_subcategory name="美达电子" value="4"/>
    </subcategory>
    <subcategory name="显卡" value="6">
    <grand_subcategory name="艾尔莎" value="39"/>
    </subcategory>
    <subcategory name="声卡" value="7">
    <grand_subcategory name="雅马哈" value="1"/>
    </subcategory>
    <subcategory name="CD-ROM" value="9">
    <grand_subcategory name="美达电子" value="57"/>
    </subcategory>
    <subcategory name="机箱" value="10">
    <grand_subcategory name="北京华旗" value="60"/>
    </subcategory>
    <subcategory name="软驱" value="23">
    <grand_subcategory name="索尼" value="16"/>
    </subcategory>
    <subcategory name="CPU" value="28">
    <grand_subcategory name="超微" value="56"/>
    </subcategory>
    <subcategory name="刻录机" value="29">
    <grand_subcategory name="超微" value="36"/>
    </subcategory>
    <subcategory name="鼠标" value="30">
    <grand_subcategory name="北京华旗" value="15"/>
    </subcategory>
    </category>
    <category name="整机" value="2">
    <subcategory name="笔记本电脑" value="16">
    <grand_subcategory name="实达电脑" value="14"/>
    </subcategory>
    </category>
    <category name="外设" value="3">
    <subcategory name="投影仪" value="14">
    <grand_subcategory name="三星" value="28"/>
    </subcategory>
    </category>
    <category name="耗材" value="4">
    <subcategory name="色带" value="50">
    <grand_subcategory name="其他厂商" value="26"/>
    </subcategory>
    </category>
    </categories>
    2. col.html:
    <html>  
      <body onload="init()">  
      <SCRIPT  LANGUAGE=JavaScript>  
      <!--
      function  checksubmit(cform){
        if  (cform.keyword.value  ==''){
        alert('请输入检索关键字');
        return  false;
        }
      }  function init()
      {
    fillList(document.form1.categoryid, xmldoc.documentElement.childNodes,'选择大类', 0);
    change_category();
      }
     
      function change_category()
      {
    var nIndex = document.form1.categoryid.selectedIndex;
    if (nIndex >=0)
    {
    fillList(document.form1.subcategoryid, nIndex == 0? null : xmldoc.documentElement.childNodes[nIndex-1].childNodes, '选择子类',0);
    fillList(document.form1.grandcategoryid, null, '选择品牌',0);
    }
      }  function change_subcategory()
      {
    var nCatIndex = document.form1.categoryid.selectedIndex;
    var nSubCatIndex = document.form1.subcategoryid.selectedIndex;
    if ((nCatIndex >= 0) && (nSubCatIndex >=0))
    {
    fillList(document.form1.grandcategoryid, 
    (nCatIndex == 0) || (nSubCatIndex == 0) ? null : 
    xmldoc.documentElement.childNodes[nCatIndex-1].childNodes[nSubCatIndex-1].childNodes,
    '选择品牌',0);
    }
      }  function fillList(oList, nodes,defaultText, defaultValue)
      {
    oList.options.length = 0;
    var opt;
    if (defaultText)
    {
    opt = new Option(defaultText, defaultValue);
    oList.options.add(opt);
    } if (nodes)
    {
       for (var i=0; i < nodes.length; i++)
       {
    opt = new Option(nodes[i].getAttribute('name'), nodes[i].getAttribute('value'));
    oList.options.add(opt);
       }
    }
      }
      //-->  
      </SCRIPT>  
      <xml id="xmldoc" src="col2.xml"></xml>
      <table  width="100%"  border="0"  cellspacing="1"  cellpadding="2"  bgcolor="BAE1F3">  
      <form  method=GET  action="search.asp"  name="form1"    target=_blank>  
                <tr  bgcolor="#FFFFFF">    
                          <td  width="46%"  colspan=3>  
                                    <div  align="center">  
      <input  type="text"  name="keyword"  size=10  class=s01  value="">  
      <select  size="1"  name="categoryid"  onchange="change_category();">      
      </select>  
      <select  size="1"  name="subcategoryid"  onchange="change_subcategory();">     
      </select>  
      <select  size="1"  name="grandcategoryid">     
      </select>    
      <input  type=submit  value="检索"  name=search  class=s03>  
      
        </div>  
       </td>  
                                        </tr>  
        </form>
    </body>
    </html>
      

  5.   

    try this:
    <HTML>
    <HEAD><TITLE></TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <SCRIPT language=JavaScript>
    <!--
    var mystat=0;//price select
    function myout(){mystat=0;window.setTimeout("mycheck()",5);}
    function myin(){mystat=1;}
    function mycheck(){if (mystat==0) MM_showHideLayers('price','','hide');}//price selectfunction MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    }function MM_findObj(n, d) { //v3.0
      var p,i,x;  
       if(!d) d=document; 
        if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
         if(!(x=d[n])&&d.all) x=d.all[n]; 
         for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
          for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
           return x;
    }function MM_showHideLayers() { //v3.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
       for (i=0; i<(args.length-2); i+=3) 
        if ((obj=MM_findObj(args[i]))!=null) 
         { v=args[i+2];
           if (obj.style) 
            { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
       obj.visibility=v; }
    }
    //-->
    </SCRIPT><STYLE type=text/css>.btd {
    FONT-SIZE: 14px
    }
    .tbline {
    BORDER-TOP: #000000 1px dotted; BORDER-BOTTOM: #000000 1px dotted
    }
    </STYLE>
    </HEAD>
    <BODY> 
    <TABLE  >
      <TR> 
        <TD > 
          <FORM class=sfont name=f1 action=="search.asp" method=post>
          <SPAN class=pt9>查询范围:</SPAN> 
          <SELECT class=pt9 onchange=changecity(this.options[this.selectedIndex].value,2) name=s1>
          <OPTION value=2 selected>北京</OPTION>
          <OPTION value=1>广州</OPTION>
          <OPTION value=3>上海</OPTION>
          <OPTION value=4>深圳</OPTION>
          <OPTION value=5>成都</OPTION>
          </SELECT>
          <SELECT class=pt9 onchange=changebig(this.options[this.selectedIndex].value) name=s2>
          <OPTION value=1>整机类</OPTION>
          <OPTION value=2 selected>电脑配件</OPTION>
          <OPTION value=3>软件</OPTION>
          <OPTION value=4>办公设备</OPTION>
          <OPTION value=5>外设</OPTION>
          <OPTION value=6>网络设备</OPTION>
          <OPTION value=7>消耗品</OPTION>
          <OPTION value=8>电源</OPTION>
          <OPTION value=9>其它</OPTION>
          <OPTION value=11>数码产品</OPTION>
          </SELECT>
          <SELECT class=pt9 onchange=changesmall(this.options[this.selectedIndex].value) name=s3>
          <OPTION value=1 selected>主板</OPTION>
          <OPTION value=2>CPU</OPTION>
          <OPTION value=3>内存</OPTION>
          <OPTION value=4>硬盘</OPTION>
          <OPTION value=5>CD/DVD光驱</OPTION>
          <OPTION value=6>DVD</OPTION>
          <OPTION value=7>显卡</OPTION>
          <OPTION value=8>声卡</OPTION>
          <OPTION value=9>软驱</OPTION>
          <OPTION value=10>鼠标</OPTION>
          <OPTION value=11>光盘塔</OPTION>
          <OPTION value=12>机箱</OPTION>
          <OPTION value=13>键盘</OPTION>
          <OPTION value=14>工控产品</OPTION>
          <OPTION value=15>各种卡类</OPTION>
          <OPTION value=16>SCSI卡</OPTION>
          <OPTION value=17>3D成像卡</OPTION>
          <OPTION value=18>IEEE1394卡</OPTION>
          </SELECT>
          <SPAN class=pt9>价格范围:从 
          <INPUT class=pt9 size=7 value=0 name=beginprice>元 <FONT color=#000000>到 
          <INPUT class=pt9 size=7 value=100000 name=endprice>元 </FONT><BR>
          <BR>
          关键字: 
          <INPUT class=pt9 size=10 name=kw1>
          <INPUT type=radio CHECKED value=and name=rdb>与 
          <INPUT type=radio value=or name=rdb>或 
          <INPUT class=pt9 size=10 name=kw2>
          <INPUT class=pt9 type=submit value=" 搜 索 " name=submit>
          </SPAN> 
          </FORM>
        </TD>
      </TR>
    </TABLE>
    </BODY>
    </HTML>