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 Mike Lewis 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 problem

Status
Not open for further replies.

rmurer

Programmer
Sep 30, 2010
1
AR
Hi friends,

I have a problem that needs your help :)

If you see this site: http://www.nosotroscinco.com"][/URL]

you will see the button +info

By clicking there, I show or hide a <div> using the below js function:

**********************************
<script language="javascript">
function toggle() {
var ele = document.getElementById("toggleText");
if(ele.style.display == "block") {
ele.style.display = "none";
}
else {
ele.style.display = "block";
window.scrollTo(100,300)
}
}
</script>
**********************************

The problem I have here, is that each time the "next" or "prev" buttons are pressed (< or >) reload the page, and I want to reload the URL but with last status for the ele.style.display.

I don´t know if I am clear enough, but for instance, I open the website home, then click in +info, it shows the hidden div, then click in next button ">", I want that +info is opened if previously it was opened.

I really appreciate your help on this, I am driving crazy and cant solve this.

Thanks & Best regards
 
Hi

Store the status in a cookie.
[ul]
[li]Search the web for some getcookie() / setcookie() functions.[/li]
[li]When the toggle link is clicked and you show/hide the [tt]div[/tt], also save the status using setcookie().[/li]
[li]When the page is loaded retrieve the status using getcookie() and show/hide the [tt]div[/tt] accordingly.[/li]
[/ul]
Note that getcookie() and setcookie() are just the most frequently used names for such functions. But there are many implementations with many names.


Feherke.
 
Since your links are flash based you are pretty much left with saving the status in a cookie, and retrieving it on page load. Then using it to set the Div's display.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top