日期:2014-05-20  浏览次数:20649 次

设置下拉框默认值
能不能在只知道下拉框的<option>value 属性的情况下 来在<script></script> 里 写这个方法 来设置 这个下拉框的默认值?

------解决方案--------------------
JScript code

    function check(){
        var sel = document.getElementById("abc");//abc为你的select的id    
        for(var i=0 ;i<sel.options.length;i++){
            if(sel.options[i].value==你知道的value){
                sel.options[i].selected=true;
            }
        }
    }

------解决方案--------------------
探讨
JScript code


function check(){
var sel = document.getElementById("abc");//abc为你的select的id
for(var i=0 ;i<sel.options.length;i++){
if(sel.options[i].value==你……