Dropdownlist的onchange事件應用


1   function selectDpList(dp) {
2             var sIndex = dp.selectedIndex;//返回選中是第幾項 0,1....
3             var sText = dp.options[dp.selectedIndex].text;//返回選中的文本--文本1,文本2 ...
4             var sValue = dp.value;//返回選中的文本--v1,v2 ...
5         }
1   <asp:DropDownList runat="server" CssClass="productType" ID="dp_ProductTag" Width="153px" onchange="JavaScript:selectDpList(this)">
2       <asp:ListItem Text="文本1" Value="1"></asp:ListItem>
3       <asp:ListItem Text="文本2" Value="2"></asp:ListItem>
4       <asp:ListItem Text="文本3" Value="2"></asp:ListItem>
5   </asp:DropDownList>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM