I'm tying to access a field in the content area of a masterpage with
function showhide(id) {
var x = alert(document.getElementById(id));
document.getElementById(id).style.visibility = 'visible';
}
to set it to visible if a tickbox is ticked
However document.getElementById(id) just seems to be coming out as null when I pass the id of the field 'txtJustification',
chkVPN.Attributes.Add("onclick","showHide('txtJustification')")
I have also tried passing the client id in asp.net
ie
chkVPN.Attributes.Add("onclick", "showHide('" + txtJustification.ClientID + "')")
but this doesn't help either
and tried
parent.document.getElementById
Frankly I'm a bit stuck and I'd appreciate any pointers if anyone can help please. I assume its due to using masterpage, though I'm also using a multiview (as cross page submitting PostBackUrl screws up with masterpages too)
Thanks
Andy
The page content is
...
<asp:Content ID="Content2" ContentPlaceHolderID="pageBody" Runat="Server">
<form id="frmOrderDetails" action="pcCheckout.aspx" method="post">
<asp:MultiView id="MultiView" runat="server" ActiveViewIndex="0">
<asp:textbox id="txtJustification" runat="server" Width="280px" TextMode="MultiLine" Height="88px" CssClass="RequiredField">
...
function showhide(id) {
var x = alert(document.getElementById(id));
document.getElementById(id).style.visibility = 'visible';
}
to set it to visible if a tickbox is ticked
However document.getElementById(id) just seems to be coming out as null when I pass the id of the field 'txtJustification',
chkVPN.Attributes.Add("onclick","showHide('txtJustification')")
I have also tried passing the client id in asp.net
ie
chkVPN.Attributes.Add("onclick", "showHide('" + txtJustification.ClientID + "')")
but this doesn't help either
and tried
parent.document.getElementById
Frankly I'm a bit stuck and I'd appreciate any pointers if anyone can help please. I assume its due to using masterpage, though I'm also using a multiview (as cross page submitting PostBackUrl screws up with masterpages too)
Thanks
Andy
The page content is
...
<asp:Content ID="Content2" ContentPlaceHolderID="pageBody" Runat="Server">
<form id="frmOrderDetails" action="pcCheckout.aspx" method="post">
<asp:MultiView id="MultiView" runat="server" ActiveViewIndex="0">
<asp:textbox id="txtJustification" runat="server" Width="280px" TextMode="MultiLine" Height="88px" CssClass="RequiredField">
...