想得到所有的option的value,怎么得到?谢谢!
Javascript取select的选中值和文本
var select = document.getElementById("selectType");
var index = select.selectedIndex;
var text = select.options[index].text;
var value = select.options[index].value;
[code="java"]
function getAllselect(linelistid) { var selEl = document.getElementById(linelistid); if(selEl && selEl.options.length > 0) { for(var i = 0; i < selEl.options.length; i++) { var option = selEl.options[choose.selectedIndex]; var opText = option.text; var opValue = option.value;//获取value值 } } }[/code]
如果是 Proptype
[code="javascript"]
$$('#linelistid option').each(function(el){return $F(el)});[/code]
如果是 Jquery
[code="javascript"]
$.each($('#linelistid option'),function(el){return el.val();});[/code]
现在的人都搞jQ去了。。。简单的自己封下就可以了
[code="javascript"]
[/code]