日期:2014-05-16  浏览次数:20566 次

select,触发js同时取得option的value 和显示的名称
<option value="${u.szj}" onclick="document.getElementById('transit_Distance').value=${{u.transit_Distance}">${u.szj_Name}</option>


---------------------------------------------
<html:select property="szj"  style=""
           onchange="document.getElementById('transit_Distance').value=document.getElementById('sss_'+this.value).value">
          <html:option value="" > 未选择 </html:option>
          <c:forEach items="${requestScope.szj_list}" var="u">
            <c:choose>
              <c:when test="${u.szj ge -1}">
                <html:option value="${u.szj}"> ${u.szj_Name} </html:option>
              </c:when>
              <c:otherwise>
                <html:option value="${u.szj}"> ${u.szj_Name} </html:option>
              </c:otherwise>
            </c:choose>
          </c:forEach>
        </html:select>
       
        <c:forEach items="${requestScope.szj_list}" var="u">
                <input id="sss_${u.szj}" value="${u.transit_Distance}" type="hidden"/>
          </c:forEach>
        </div></td>