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.
If you can use php, you can store the display status of the div (dispStatus) in a session variable. Each time the +info is clicked you also update a hidden input element with the current display status.
On each page load you check the value of the hidden element being passed to the page and then store it in a global javascript variable.
<script type="text/javascript?>
var dispStatus = <?php echo $_POST['txtDispStatus']; ?>;
</script>
If you have to do it on client side only, you can either use cookies to store the current display status or append the display status as a query string parameter the the page’s url and then parse the quesry string on each page load to get the current display status.
Thanks Kalon, that would work fine, but not completely, since I have too an swf movie that links to other pages, and too need to pass the status that holds the javascript function, in this case I think it´s impossible… not sure.
hahaha Kalon, the status for the div to be hidden/shown, is changed by the javascript function toggle(), and this status should be passed to the swf movie too, in order to click in next/prev buttons that this swf movie holds.