<select id="select_service" style="width: 200px;" onchange="select()" runat="server" >
    <option value="1">第一项</option>
    <option value="2">第二项</option>
    <option value="3">第三项</option>
</select><script type="text/javascript">
    var globals = {}; 
    globals.controlIdentities = {}; 
    globals.controlIdentities.select_service = '<%= select_service.ClientID %>';
</script>var selectvalue=document.getElementById(globals.controlIdentities.select_service).value;//这句没有执行
alert(selectvalue);各位,这是为什么呢,到底要怎么才能取到这个select的值呢
因为这个select在后台也要用到的,所以我只能加了runat="server"了

解决方案 »

  1.   

    string value=Request.Form["select_service"].ToString();
      

  2.   

    额,这个,怎么还string呢,我要在JS里取值啊
      

  3.   

    <select id="select_service" style="width: 200px;" onchange="select()" runat="server" >
    <option value="1">第一项</option>
    <option value="2">第二项</option>
    <option value="3">第三项</option>
    </select><script type="text/javascript">
        var globals = {}; 
        globals.controlIdentities = {}; 
        globals.controlIdentities.select_service = '<%= select_service.ClientID %>';
    </script>
    <script>
    function select()
    {
        var selectvalue=document.getElementById(globals.controlIdentities.select_service).value;//这句没有执行
        alert(selectvalue);
    }自己测试吧
    </script>
      

  4.   

    Sorry啊,低级错误查了好几遍,原来最后多了个}