首页 > 代码库 > document.forms 获取 name 得到select 对象

document.forms 获取 name 得到select 对象

 < html > < body > < form name = "t_form" >     < select name = "t_select" >     < option value = "first" selected > 1 <  / option >     < option value = "second" > 2 <  / option >     <  / select >     <  / form >     < script >    var obj = document.forms[‘t_form‘].t_select    var index = obj.selectedIndex;    alert(obj.options[index].value) <  / script > <  / body ><  / html >

 

document.forms 获取 name 得到select 对象