文本框值未填充 [英] text box value not getting populated

查看:163
本文介绍了文本框值未填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要填写txtnoofpersons onchange的txtadult字段。 jscript运行正常但是txtadult没有显示在

表单中。下面给出了jscript和html代码以供参考。请告诉我发生了什么事情

I need to fill the txtadult field at onchange of txtnoofpersons. The jscript is running fine but txtadult is not shown in the
form. the jscript and the html code is given below for reference. Kindly tell me what is going worng

function filladult(nopersons)
    {

    alert("you are here :" + nopersons);

     document.getElementById(''txtadult'').value= nopersons;
    }




-----------
<asp:TextBox ID="txtnoofperson" runat="server" BorderColor="LightGray" BorderStyle="Solid"

                                                                                                            BorderWidth="1px" CssClass="tabForm" Width="50px" OnFocus="this.style.backgroundColor='#F9FEE0',this.style.borderColor='#000000'"

                                                                                                            OnBlur="this.style.backgroundColor='',this.style.borderColor=''"

                                                                                                            OnTextChanged="txtnoperson" onchange ="filladult(this.value)"> </asp:TextBox>
                                                                                                        <cc1:FilteredTextBoxExtender ID="txtnoofperson_FilteredTextBoxExtender" runat="server"

                                                                                                            Enabled="True" FilterType="Numbers" TargetControlID="txtnoofperson">
                                                                                                        </cc1:FilteredTextBoxExtender>
-------
<asp:TextBox ID="txtadult" runat="server"  BorderColor="LightGray"

                                                                                                            BorderStyle="Solid" BorderWidth="1px" CssClass="tabForm" Width="50px" OnFocus="this.style.backgroundColor='#F9FEE0',this.style.borderColor='#000000'"

                                                                                                            OnBlur="this.style.backgroundColor='',this.style.borderColor=''"

                                                                                                            Enabled="False"></asp:TextBox>

推荐答案

function filladult(nopersons)
    {

    alert("you are here :" + nopersons);
     document.getElementById(<%=txtadult.ClientID%>).value= nopersons;
    }


function filladult(nopersons)
    {

    alert("you are here :" + nopersons);
     document.getElementById(<%= txtadult.ClientID %>).value= nopersons;
    }











or

function filladult(nopersons)
    {

    alert("you are here :" + nopersons);


(#txtadult) .val()= nopersons;
}
("#txtadult").val()= nopersons; }





确保已将js.min包含在您的页面中



Make sure you have included the js.min to your page for "


这篇关于文本框值未填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆