同时获取下拉框的Value和Text值的解决办法:
添加一个<p>标签,用户选中一项后就将该项的Text赋值给他
然后接受页面获取该P变迁即可获取到相应的Text值
表单填写页面:
[html]view plaincopy <formaction="submit.php"method="post"><div><labelfor="workYear">工作年限<em>*</em></label><selectname="workYear"class="weight190"id="workYear"><optionvalue="0">---请选择---</option><OPTIONVALUE=1>在读学生</OPTION><OPTIONVALUE=2>应届毕业生</OPTION><OPTIONVALUE=3>一年以上</OPTION><OPTIONVALUE=4>二年以上</OPTION><OPTIONVALUE=5>三年以上</OPTION><OPTIONVALUE=6>五年以上</OPTION><OPTIONVALUE=7>八年以上</OPTION><OPTIONVALUE=8>十年以上</OPTION></select><pclass="note"name="workYear_note"id="workYear_note"></p></div></form><script>$("#workYear").change(function(){//code...varworkYear_note=$("#workYear").find("option:selected").text();$("#workYear_note").text(workYear_note);});</script>
PHP获取页面submit.php:
[php]view plaincopy $infobean->WorkIndustryID=$_POST['workYear'];ean->WorkIndustryName=$_POST['workYear_note'];
至此轻松+成功解决问题!
来源:/hurryjiang/article/details/6975194