项目中经常用到Select标签,用封装好的方法获取option,可以避免冗赘的代码: 1.JSP--标签 <select class="width_md" name="queryProjectSupType" id="queryProjectSupType" title="项目类型-大类"></select> 2.JS1--实例化option <script type="text/jav…
<script> function add(){            var prop_name=$("#prop").find("option:selected").text();} </script> <select id="prop"> <option value="值">文本</option> </select>…
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><h…
<select name="procode" onchange="alert(this.options[this.selectedIndex].text)"> <option value="100">北京</option> <option value="200">广东</option> <option value="210">上海<…
js获取select标签选中的值 var obj = document.getElementById(”testSelect”); var index = obj.selectedIndex; var text = obj.options[index].text; var value = obj.options[index].value; jQuery中获得选中select值 $('#testSelect option:selected').text();//文本 $('#testSelect'…
.net获取select控件中的文本内容 2009-11-28 21:19小V古 | 分类:C#/.NET | 浏览1374次 <select id="SecType" style="z-index: 104; left: 93px; width: 151px; position: absolute; top: 27px" runat="server"> <option selected="selected"…
<select name="month" id="selMonth">    <option value="1">一月</option>    <option value="2">二月</option>    <option value="3">三月</option>    <option value="4&…
var obj = document.getElementByIdx_x(”testSelect”); //定位id var index = obj.selectedIndex; // 选中索引 var text = obj.options[index].text; // 选中文本 var value = obj.options[index].value; // 选中值 jQuery中获得选中select值 第一种方式$('#testSelect option:selected').text()…
<select name="select1" id="select1" onchange=setInput()> <option value="1">FIRST BLOOD</option> <option value="2">SECOND BLOOD</option> <option value="3">THIRD BLOOD<…
在ie下面使用innerHTML来插入option选项的话,ie会去掉前面的<option>,并拆分成多个节点,这样会造成select的出错   前言: 这是一个老bug了,现在提供一个完美解决方案.由于我一直是用createElement来创建动态的option并添加,所以一直没 有遇到这个问题,但是每个人写代码风格不同,有的人就喜欢写字符串形式的标签并用innerHTML插入,这不就有问题了,为了方便不同编码风格的人,我 封装了一个方法,用于解决ie的这个bug和兼容5大浏览器,这样大家都…