Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display set to None doesn't fully work

Status
Not open for further replies.

olypost

Programmer
Apr 15, 2005
43
US
I have an html button control that I want to hide based on a certain value.

When my page first loads, the display is set to none. Then I do:

if (str == "NO") {
document.getElementById('gob').style.display = "none"; }
else {
document.getElementById('gob').style.display = "block"; }

The first time str is NO, I don't see the button, which is fine.

The first time it goes into the else condition, I see the button, which is fine.

But the next time str is NO, for some reason I can still see the button with no text in the button.

If I refresh the page, it resets the page so that if str is NO, I don't see the button.

If I do a response.redirect it should work--how do I do something like that with clientside javascript??

Thanks.
 
the next time str is NO, for some reason I can still see the button

- Are you sure str is "NO" (all uppercase)?
- Are you sure your script is running the second time?

If so, can you post your page code (or better still, a cut-down test harness)? The code you've shown should work, so I imagine you have an error elsewhere.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top