Hi,
I need your help with javascript.
One one page I’m trying to show a layer only if the visitor hasn’t been on another page. The setCookie and getCookie functions work great, the showlayer function works great. The problem is that I’m not able to execute the showlayer function when no cookie is found. I’ll post the code below so you can take a look at it.
The function that shows/hides the layer:
[code]
function OpenPop(DivID, iState) // 1 visible, 0 hidden
{
if(document.layers) //NN4+
{
document.layers[DivID].visibility = iState ? “show” : “hide”;
}
else if(document.getElementById) //gecko(NN6) + IE 5+
{
var obj = document.getElementById(DivID);
obj.style.visibility = iState ? “visible” : “hidden”;
}
else if(document.all) // IE 4
{
document.all[DivID].style.visibility = iState ? “visible” : “hidden”;
}
}
The code from the body:
[code]
<body onLoad=”begintimer()”>
<!– Start Floating Layer –>
<div id=”FloatingLayer” style=”position:absolute;width:400px;left:100;top:100;visibility:hidden”>
<p align=”center”><a href=”#” onClick=”ClosePop(‘FloatingLayer’,0);return false”><font color=”#000000″ size=”2″ face=”arial” style=”text-decoration:none”><img src=”donate.gif”></font></a></p>
</div>
<!– End Floating layer –>
<script type=”text/javascript” language=”JavaScript”>
<!–
if getCookie(“here”)!=”yes” OpenPop(‘FloatingLayer’,1);
// –>
</script>
</body>
Here’s the link to a live test:
[url]http://www.3afaceri.ro/fbb/cookie
[url]http://www.3afaceri.ro/fbb/cookie/donate.htm
Hope you can help me with that 😮 .
Thanks in advance,
Valentin