您的位置:首页 > Web前端 > JavaScript

JS控制select的默认选中项

2017-01-06 14:19 337 查看
<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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: