往下拉列表加option,不成功,怎么回事?
var response="<option value=0 selected='selected'>--请选择--</option>
<option value=1 >aa</option>
<option value=2 >bb</option>
<option value=3 >cc</option>"document.getElementById("select1").innerHTML=response;
上面那样添加不行,求解?

解决方案 »

  1.   

    应该可以的,放的时间不对。放到select1的HTML代码后面
      

  2.   

    我是等页面加载玩了在加载的JS,是对的,用alert都弹的出来,就是加不上去.....
      

  3.   

    引用Jqueryvar response="<option value=0 selected='selected'>--请选择--</option>";
    $("#response").append("<option value=1 >aa</option>");
    ……
    ……
    $("#select1").html(response);
      

  4.   

    var o=document.getElementById("select1");
    var op =document.createElement("option");
    op.value="123";
    op.text="123";
    o.add(op);