JS控制select的默認選中項

<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<title>無標題頁</title>

</head>

<script type="text/javascript">
        function SELECT(index){
            var select = document.getElementById("Select1");
            select.selectedIndex=index;
        }

        $(document).ready(function () {
         SELECT(1);
       });
    </script>

<body>
 <form id="form1" runat="server">
  <select id="Select1">
   <option value="0">否</option>
   <option value="1">是</option>
  </select>
  <div></div>
 </form>
</body>

 

參考源碼:

http://download.csdn.net/detail/liangzhuangdongtou/9730567

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章