This is probably an obvious mistake on my part. I have a C# page that has a button that when clicked opens a calendar (ASP classic) in an iFrame. That calendar is passed the ClientID of the button as AddToCartButton and uses this line:
lo("parent.document.getElementById('" & AddToCartButton & "').style.display = 'none';")
(lo is a Response.Write type function and simply outputs the text to the page.)
to hide the button when the calendar appears. After the user selects a date the calendar uses a similar line to put the date into my C# textbox:
lo("parent.document.getElementById('" & PostBackField & "').value = '" & Replace(CurrentDate,":00 "," ") & "';")
This all works great but when I try to turn the button back on with:
lo("parent.document.getElementById('" & AddToCartButton & "').style.display = '';")
nothing happens. I have also tried ‘inline’ with similar non-results. Does anyone have an idea from what I’ve written here what I’m doing wrong?
You should be using Visibility instead of display, but I can’t see why your code isn’t working with the display.
and then
Setting the display to hidden removes the item from the flow, where visibility keeps the item in place, and just hides it, which I think is what you want.
Here is a good article explaining the differences.
Here is a quick sample I threw together.
If you run this example, click the show and hide buttons. You’ll notice how they keep there place on the page. Click the remove button, and they will all shift to the left.