从下拉列表中选择其他值时激活文本框 [英] activating textbox on selecting Others value from dropdown
本文介绍了从下拉列表中选择其他值时激活文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在从下拉列表中选择其他选项时出现文本框我的代码在下面给出它不工作的plzz帮助我
I need the textbox to appear when option other is selected from dropdown my code is give below its not working plzz help me
<asp:DropDownList ID="DdlOccupation" runat="server" class="select03" Height="25px" OnSelectedIndexChanged="if(this.value=='OTHERS'){this.form['other'].style.visible='true'}else{this.form['other'].style.visible='false'};"
Width="150px">
<asp:ListItem Value="Select">Select</asp:ListItem>
<asp:ListItem Value="1">BUSINESS</asp:ListItem>
<asp:ListItem Value="2">FARMER</asp:ListItem>
<asp:ListItem Value="3">HOUSEWIFE</asp:ListItem>
<asp:ListItem Value="4">RETIRED</asp:ListItem>
<asp:ListItem Value="5">SERVICE</asp:ListItem>
<asp:ListItem Value="6">STUDENT</asp:ListItem>
<asp:ListItem Value="7">OTHERS</asp:ListItem>
</asp:DropDownList>
<td>
<asp:TextBox ID="txtOther" Autocomplete="off" size="20" Height="25" class="incl" width="150px" runat="server" Visible="false"></asp:TextBox>
</td>
推荐答案
你的文本框id具有与脚本中提到的不同的值(txtOther)。
尝试更改this.form ['other'] to this.form ['txtOther']
希望这会对你有所帮助。
问候,
RK
Hi,
You textbox id has different value(txtOther) other than mentioned in the script.
Try to changethis.form['other'] to this.form['txtOther']
Hope this helps you a bit.
Regards,
RK
<script type="text/javascript">
(document).ready(function(){
(document).ready(function () {
这篇关于从下拉列表中选择其他值时激活文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文