Hi all
I am creating an anchor tag on my page, and I am placing a div tag inside that. Inside the div tag I am placing various asp.net controls. When the page loads the visible property of the anchor tag should be false.
I have a html button outside of the anchor tag that should set the visibilty of the anchor tag to true using javascript. I also have another html button inside the div tag that calls javascipt to set the visibility of the anchor tag to false.
Here is the javascript code:
When I click the button to change the visibilty of the anchor tag to true, I get the following error:
The javascript code cannot seem to find the anchor tag. Any suggestions on how to overcome this problem. I am using javascript and html buttons in an attempt to reduce post back. I am also going to have a look at ajax now to see if that can help.
Mike55.
I am creating an anchor tag on my page, and I am placing a div tag inside that. Inside the div tag I am placing various asp.net controls. When the page loads the visible property of the anchor tag should be false.
Code:
<a id="dControls" runat="server" visible="false" >
<div runat="server" style="width: 301px; height: 64px" id="test">
<asp:CheckBox ID="CheckBox1" runat="server" />
<input id="Button1" title="Close" type="button" value="Close" onclick="Hide();" />
</div>
</a>
I have a html button outside of the anchor tag that should set the visibilty of the anchor tag to true using javascript. I also have another html button inside the div tag that calls javascipt to set the visibility of the anchor tag to false.
Code:
<input id="Button2" title="Advanced" type="button" value="Advanced" onclick="Show();" />
Here is the javascript code:
Code:
<script language="jscript" type="text/jscript">
function Show()
{
document.getElementById("dControls").visible = true;
}
function Hide()
{
document.getElementById("dControls").visible = false;
}
</script>
When I click the button to change the visibilty of the anchor tag to true, I get the following error:
Microsoft JScript runtime error: document.getElementById(...) is null or not an object
The javascript code cannot seem to find the anchor tag. Any suggestions on how to overcome this problem. I am using javascript and html buttons in an attempt to reduce post back. I am also going to have a look at ajax now to see if that can help.
Mike55.