关于用了母版页,在源代码中的JS中能不能取到文本框的值?
<%@ Page Language= "VB " MasterPageFile= "~/FrmMasterPage.master " AutoEventWireup= "false " CodeFile= "NetConMoney.aspx.vb " Inherits= "NetConMoney " title= "会员消费界面 " %>
<asp:Content ID= "Content1 " ContentPlaceHolderID= "ContentPlaceHolder1 " Runat= "Server ">
<script language= "javascript ">
function MyTotalOne()
{
var nynam=document.getElementById( 'txtAirTicktPrice1 ').value;
alert(nynam);
}
</script>
<asp:TextBox ID= "txtAirTicktPrice1 " runat= "server " Width= "50px " onblur= "MyTotalOne() ">
</asp:TextBox>
</asp:Content>
以上是代码。请高手指点。怎么样才可以取到下面的文本框值。用了母版页的啦。
------解决方案--------------------母版页的控件ID要这么取
var id= ' <%=txtAirTicktPrice1.ClientID%> ';
------解决方案--------------------var nynam=document.getElementById( ' <%=txtAirTicktPrice1.ClientID%> ').value;
alert(nynam);