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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Hide Div

Status
Not open for further replies.

wilberforce2

IS-IT--Management
Joined
Jan 8, 2007
Messages
36
Location
GB

I have been using a simple show hide function in JS example below to hide a Div (the default is hide)

Code:
function showHide(elementId, show) {
	var element = document.getElementById(elementId);
	if (show == 'true')
		{
			element.style.display = "block";
		}
		else
		{
			element.style.display = "none";
		}
}

The problem that I am having is after the page is viewed and the user navigates away, if the back button is pressed in IE on a PC the div is hidden again. I have tried to check unhide the div but the JS runs before the page is completed even when the function call is the last thing on the page.

I am completely stuck with this problem it works fine in firefox and safari on the Mac. Does any one have any ideas to help me solve this problem?

Thanks
 
Try using a cookie or session variable.
 
Thaks for your reply.

I tried a asp session unfortunately it does not seam to work when the back buton is pressed.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top