如何获取下拉框选中项的内容?
Posted 四哥-云上
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何获取下拉框选中项的内容?相关的知识,希望对你有一定的参考价值。
如何获取下拉框选中项的内容?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>如何获取下拉框选中项的内容? </title>
<style>
.redcolor:red;
</style>
</head>
<body>
<span class="red">*</span>
地 区:
<span>
<select id="AreaId" name="AreaId" size="1" class="sel">
<option>-请选择地区-</option>
<option selected="selected" value="1">北京</option>
<option value="2">上海</option>
<option value="3">天津</option>
<option value="4">广州</option>
</select>
</span>
<script type="text/javascript">
var Obj = document.getElementById("AreaId");
Area_Value = Obj.options[Obj.selectedIndex].value;
Area_Text = Obj.options[Obj.selectedIndex].text;
alert(Area_Value);
alert(Area_Text);
</script>
</body>
</html>
以上是关于如何获取下拉框选中项的内容?的主要内容,如果未能解决你的问题,请参考以下文章
easyui里面如何实现选中下拉框中的内容然后其他栏随着下拉框中内容变化而变化