<select id="tradeList" name="Input" size="6" style="height: 80px; width: 360px;" multiple="multiple"></select>如何取到该值

解决方案 »

  1.   

    jquery
    $("#tradeList:selected").each(function(){
     alert(this.val());
    });
      

  2.   

    你是要JAVA后台取值还是JS页面取值?如果是JS页面取值的话   doucument.all.Input.value  或者document.getElementById(tradeList).value  后台取值么直接request.getParameter("Input")
      

  3.   

    var abc =document.getElementById("tradeList").value;
      

  4.   

    干嘛要取名又取ID的呀?
    可以getElementById也好,也可以getElementByName,也可以document.(form名).标记名.value
    或者document.(form[第几个form]).标记名.value方法有很多啊
      

  5.   


    String[]   str=   request.getParameterValues("Input");   
            for(int   i=0;i<str.length;i++){   
                    System.out.println(str[i]+"@@@"); 
            }  是JAVA后台取值,我这样拿到的值是空的,
      

  6.   

    你要先在页面提交的时候将Input的值全部选定.使用Js来实现
    functin checkSubmit()
    {
        .......你自己的其他验证
        var ops = document.getElementById("tradeList").options;
        for (var i=0; i< ops.length; i++)
        {
            ops[i].selected = true;
        }
        return true;
    }后台Action :
    String[] inputs = request.getParameterValues("Input");
    if (null != inputs && inputs.length > 0)
    {
        ........
    }