PDA

View Full Version : Using getElementById to hide/show layers but would like to save to cookie


Vigo
02-03-2003, 07:14 AM
Hi .... I am currently working on a project, which involves showing and hiding layers using for example:
<A onclick="document.getElementById'layer1').style.visibility='hidden'; return false;" href="#">Invisible</A>

but I Don't know how to save to a cookie... and wish to have multiple layers with the hide/show option... can anyone help?
thanks

joeframbach
02-03-2003, 01:25 PM
so you want the layer to hide when they do something, and then every time they enter the site?

fuction getCookies()
{
if(unescape(document.cookies()).indexOf("REVISIT;")!=-1)
document.getElementById'layer1').style.visibility='hidden'
}

function setCookies()
{
var exp=new Date(December 31, 2005).toGMTString()
document.cookies=escape("REVISIT;expires="+exp)
<A onclick="document.getElementById'layer1').style.visibility='hidden'; return false;" href="#">Invisible</A>

}


body onload=getcookies

a onclick=setcookies

Vigo
02-07-2003, 09:02 AM
Thanks that will be a great help!

cheers


:thumbsup: