js代码
下拉列表选项中 有:“001 中国”,“002 美国”
这种选项时候 
选择提交出来的数据是 “001”,“002”
自动把后面的汉字去掉了
为什么呢?var selDrp = document.all.dw;
for(var j=0;j<selDrp.options.length;j++) 
    {
if(selDrp.options[j].selected) 
{
selectedDW+=selDrp.options[j].value+";";           
}

解决方案 »

  1.   

    用encodeURIComponent编码试试看<script>
    function doit(){
      var selDrp = document.getElementById("dw");
       var selectedDW = ""
      for(var j=0;j<selDrp.options.length;j++) 
      {
         if(selDrp.options[j].selected) 
         {
             selectedDW+=encodeURIComponent(selDrp.options[j].value)+",";           
         }
      }
      if(selectedDW!="") selectedDW=selectedDW.substr(0,selectedDW.length-1)
      alert(selectedDW)
    }
    </script>
    <select id="dw" multiple size="10">
    <option value="001 中国">001 中国</option>
    <option value="002 美国">002 美国</option>
    <option value="003 日本">003 日本</option>
    <option value="004 法国">004 法国</option>
    <option value="005 英国">005 英国</option>
    </select>
    <input type="button" onclick="doit()">
      

  2.   

    呵呵,lz 晕了吧,先去看看 html 源码,估计就是下面这个样子吧  <select id="">
    <option value="001">001 中国</option>
    <option value="002">002 美国</option>
      </select>要 text 就把 value 改成 text!
    L@_@K
    var selDrp = document.all.dw;
    for(var j=0;j<selDrp.options.length;j++) 
        {
                if(selDrp.options[j].selected) 
                {
                    selectedDW+=selDrp.options[j].text+";";// text!!!
                }
            }  
      

  3.   


    public class TestFor {
    public static void main(String[] args) {
    int i = 40;

    if (i<20) {
    System.out.println("a");
    }
    else if (i<40) {
    System.out.println("b");
    }
    else {
    System.out.println("c");
    }
    }
    }