Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Hidden DIV state?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedHidden DIV state?

 Post Reply Post Reply
Author
Mikey View Drop Down
Senior Member
Senior Member

1979

Joined: 06 October 2003
Location: United Kingdom
Status: Offline
Points: 839
Direct Link To This Post Topic: Hidden DIV state?
    Posted: 15 April 2006 at 3:52pm
I'm trying to impliment the use of DIV blocks in the left hand side bar of my currently in development website.
The idea is to have these blocks so they can be toggled between hidden and shown. this bit i have already managed to do but now i need to find a way for them to remain in the users chosen state while they browse around the site.
Presently they pop back to their default state with every page refresh or change.

I'm aware that i could have this on either a per session or a perminant cookie but have absoloutley no idea how to get this working.

So it falls to me to ask the wonderful members of Web Wiz (Wink arse kissing) the best way to do this or any ideas i should take into concideration?

Cheers in advance for any help offered.

Demo page

If you wanna see what i'm talking about click the 'member control panel' or 'SNS Mailing List' links. Tongue
Handyman man?
Back to Top
pilot99 View Drop Down
Groupie
Groupie


Joined: 05 July 2004
Status: Offline
Points: 167
Direct Link To This Post Posted: 21 April 2006 at 2:22am
you would have to do something like when you click hide the write a cookie that says hide it then have an if statement. if i could see the code youve already made i might be able to help u more.
Back to Top
Mikey View Drop Down
Senior Member
Senior Member

1979

Joined: 06 October 2003
Location: United Kingdom
Status: Offline
Points: 839
Direct Link To This Post Posted: 21 April 2006 at 3:53pm
Damn i knew it would come down to cookies, i suck at cookies LOL

Currently i have this code in a seperate 'tooglediv.js' file

function toggleLayer(whichLayer)
{
if (document.getElementById)
{
//Standardising
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// Crappy IE version
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// NN4
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}


And this is the code thats called in the page that the .js is included in

<div id="containerlayer">
<a href="javascript:toggleLayer('hideablelayer');">
Click to toggle layer
</a>
<div id="hideablelayer">
<!-- ### Content to show or hide is in here ### --->
</div>
</div


and the CSS for the toggle'able layer is...

div#hideablelayer
{
margin: 0px 0px 0px 0px;
display: none;
}

Handyman man?
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Direct Link To This Post Posted: 21 April 2006 at 7:18pm
If it's just needed for the life of the session, I'd use the session object server side - e.g. Session("page1_div1"} = "hidden" and use it to customize inline css for the page

Lead me not into temptation... I know the short cut, follow me.
Back to Top
Mikey View Drop Down
Senior Member
Senior Member

1979

Joined: 06 October 2003
Location: United Kingdom
Status: Offline
Points: 839
Direct Link To This Post Posted: 21 April 2006 at 8:55pm
Woah thats already exceeded my skill capacity LOL

Thanks for the suggestions, i'll go away and read up on them see what i can figure out
Handyman man?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.