首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

设置下拉框默认值解决思路

2011-12-28 
设置下拉框默认值能不能在只知道下拉框的optionvalue属性的情况下来在script/script里写这个方法 来

设置下拉框默认值
能不能在只知道下拉框的<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==你……

热点排行