例子,jquery实现select下拉框的取值与赋值。
<html>
<select id='f_select'>
<option value='a1'>a1</option>
<option value='a2'>a2</option>
<option value='a3'>a3</option>
</select>
<input value="a3" id="input_1">
</html>
<script type="text/javascript">
$(function(){
var v1 = $("#input_1").attr('value');
$("#f_select option[value='"+v1+"'] ").attr("selected",true);//改值
var v_select = $("#f_select ").val();//取值
alert(v_select);
});
</script>