解决方案 »

  1.   

    干嘛不用jquery 几句话解决
      

  2.   

     
    var selectSecond = $("#SelectSecond");修改为
    var selectSecond = $("#<%=SelectSecond.ClientID %>");
      

  3.   


    function createTag(parentTagId, childTag){
        var thisObj=document.createElement(childTag);
        var parent =document.getElementById(parentTagId);
        parent.appendChild(thisObj);
        return thisObj;
    }
    ........
    if (data) {
            var jsonObject=eval("("+data.Table+")");  //转换返回的josn数组,使其变为可操作对象
            var selectSecond = $("#SelectSecond");
            selectSecond.empty();
            for(var obj in jsonObject){
                var createObj = createTag('SelectSecond', 'option');
                createObj.innerHTML = obj;
                createObj.value = jsonObject[obj];
            }
    }
      

  4.   

    selectSecond.options.add(Opt);应该改为selectSecond.options.add(Opt, null);
      

  5.   

    运行的时候 这里出错 var jsonObject=eval("("+data.Table+")"); 
    Microsoft JScript 运行时错误: 缺少 ']'
      

  6.   

    楼主用的浏览器不是IE吧,slect添加option应该这样写: try
        {
        selectSecond.options.add(Opt, null);  // standards compliant
        }
      catch(ex)
        {
        selectSecond.options.add(Opt);  // IE only
        }
      }
      

  7.   

    我用的就是IE 
    selectSecond.options在这里 提示获取不到 options这属性啊undefined
      

  8.   

    推荐jquery直接append就可以了,不用这么麻烦
      

  9.   

    <select id="SelectSecond" onchange="selected()"></select>
    <select id="SelectSecond1" onchange="selected()"></select>
    <script>
    //模拟数据
    d = [
      {numbers:1, notects:'a'},
      {numbers:2, notects:'b'},
      {numbers:3, notects:'c'}
    ];//jquery 写法
    $.each(d, function(i, t) {
    $("<option value='"+t.numbers+"'>"+t.notects+"</option>").appendTo($('#SelectSecond'));
    });//js 写法
    for(i=0; i<d.length; i++) {
      o = new Option(d[i].notects, d[i].numbers);
      document.getElementById('SelectSecond1').options[i] = o;
    }
    </script>
      

  10.   

    我用的就是IE 
    selectSecond.options在这里 提示获取不到 options这属性啊undefined
    不好意思,我写错了,应该是 try
        {
        selectSecond.add(Opt, null);  // standards compliant
        }
      catch(ex)
        {
        selectSecond.add(Opt);  // IE only
        }
      }

    你再试试,绝对可以的。
      

  11.   

    其实就是你的 selectSecond.options.add(Opt); 这句话里多了options