Hi all,
what I am trying to do is when a user clicks on a button, show that div. I can get that to work. But, I also want to hide that button after it is clicked. That doesn't work and breaks the rest of the script so it doesn't work at all.....
The html for both examples is
This works:
This does not.....
When I add the lines for style3, when I load the page, I get
Any ideas about where I am going wrong?
Thanks!
Jim
what I am trying to do is when a user clicks on a button, show that div. I can get that to work. But, I also want to hide that button after it is clicked. That doesn't work and breaks the rest of the script so it doesn't work at all.....
The html for both examples is
Code:
<input style="display:all" id="update" type="button" value="Change Password" onclick="javascript:toggleLayer('frm1');" />
Code:
function toggleLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}
This does not.....
Code:
function toggleLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
var style3 = document.getElementById(update).style;
style2.display = style2.display? "":"block";
style3.display = style3.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
var style3 = document.all[update].style;
style2.display = style2.display? "":"block";
style3.display = style3.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
var style3 = document.layers[update].style;
style2.display = style2.display? "":"block";
style3.display = style3.display? "":"block";
}
}
When I add the lines for style3, when I load the page, I get
And when I click the button, I get the errorError in parsing value for property 'display.' Declaration dropped.
update is not defined
Any ideas about where I am going wrong?
Thanks!
Jim