如何利用javascript获取表单中select下拉列表中所选中项的值value
展开全部
<select name='select'>
<option value='apple'>apple</option>
<option value='meizu'>meizu</option>
<option value='mi'>mi</option>
</select>
<script>
var obj = document.getElementsByTagName('select')[0];
obj.onchange = function(){
var value = this.value;
alert(value);
}
</script>
<option value='apple'>apple</option>
<option value='meizu'>meizu</option>
<option value='mi'>mi</option>
</select>
<script>
var obj = document.getElementsByTagName('select')[0];
obj.onchange = function(){
var value = this.value;
alert(value);
}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询