故,獲得當前 select 元素值的腳本如下:
代碼如下:
var getSelectValue = funtion(select) {
var idx = select.selectedIndex,
option,
value;
if (idx > -1) {
option = select.options[idx];
value = option.attributes.value;
return (value && value.specified) ? option.value : option.text);
}
return null;
}
新聞熱點
疑難解答
圖片精選