省市联动,在编辑的时候如何让需要编辑的项处于选中状态, 
省:<select name="s1" id="s1" runat="server">
 <option></option>
</select>

解决方案 »

  1.   


     <select id="sel1">
                <option value="val1">option1</option>
                <option value="val2">option2</option>
                <option value="val3">option3</option>
            </select>
            <script language="javascript" type="text/javascript">
                function SetValue(value) {
                    var sel = document.getElementById("sel1");                for (var i = 0; i < sel.options.length; i++) {
                        if (sel.options[i].value == value) {
                            document.getElementById("sel1").selectedIndex = i;
                        }
                    }
                }
                SetValue("val2");
            </script>