js获取select值
- <script language="javascript">
- function selectInput(choose){
- alert(choose.value);
- alert(choose.options[choose.selectedIndex].text);
- }
- </script>
- <select name="Month" onchange="selectInput(this)">
- <option value="01">January</option>
- <option value="02">February</option>
- <option value="03">March</option>
- <option value="04">April</option>
- <option value="05">May</option>
- <option value="06">June</option>
- <option value="07">July</option>
- <option value="08" selected="selected">August</option>
- <option value="09">September</option>
- <option value="10">October</option>
- <option value="11">November</option>
- <option value="12">December</option>
- </select>
js改变select值
- <script>
- function fid_check(){
- alert('不能选择大分类,请选择黑色字体的小分类');
- document.getElementById('isempty').selected=true;
- }
- </script>
- <select>
- <option id="isempty" value="">--请选择--</option>
- <option value="大分类">大分类</option>
- <option value="小分类">小分类</option>
- </select>
转载于:https://blog.51cto.com/xuqin/1095871