nichtmich
01-15-2003, 06:08 PM
Hello, I hope someone can help me out.
I am battling with a little javascript snippet that I picked up somewhere else. Anyway, at the moment all it does is hide or show an inline element.
The javascript code:
function toggle( targetId ){
if (document.getElementById){
target = document.getElementById( targetId );
if (target.style.display == "none"){
target.style.display = "";
document.
} else {
target.style.display = "none";
}
}
}
Then I have an inline element, for instance. In this example it is shown by default.
<div id="contributors" style="display:"";">
Content to hide or show here
</div>
To toggle back and forth between the two I've used the following:
<a href="#" onclick="toggle('contributors');return false;">Toggle</a>
Anyway, to the question. I am using this function on two seperate inline elements across an entire site, and I want the browser to remember the settings from the previous page. I am not quite sure, but I think this is possible with cookie management, so that it writes a cookie for when the inline element 'contributors' is toggled and remembers the setting on the next page, or when the user returns to the site (hopefully).
Thanks in Advance,
Nicht Mich
I am battling with a little javascript snippet that I picked up somewhere else. Anyway, at the moment all it does is hide or show an inline element.
The javascript code:
function toggle( targetId ){
if (document.getElementById){
target = document.getElementById( targetId );
if (target.style.display == "none"){
target.style.display = "";
document.
} else {
target.style.display = "none";
}
}
}
Then I have an inline element, for instance. In this example it is shown by default.
<div id="contributors" style="display:"";">
Content to hide or show here
</div>
To toggle back and forth between the two I've used the following:
<a href="#" onclick="toggle('contributors');return false;">Toggle</a>
Anyway, to the question. I am using this function on two seperate inline elements across an entire site, and I want the browser to remember the settings from the previous page. I am not quite sure, but I think this is possible with cookie management, so that it writes a cookie for when the inline element 'contributors' is toggled and remembers the setting on the next page, or when the user returns to the site (hopefully).
Thanks in Advance,
Nicht Mich