Hai Guys,

I hope some of you know your php / javascript, because I sure don't ... ;D.

For my website I want a lightbox called slimbox to onLoad once... and only once ever.

This is the script I am using at the moment (below), the only problem with it is that it onLoads once per sesson, so when the user restarts their web browser... it onLoads again which is what I don't want, I only want it to onLoad ONCE EVER.


<script>
var key_value = "myTestCookie=true";
var foundCookie = 0;

// Get all the cookies from this site and store in an array
var cookieArray = document.cookie.split(';');

// Walk through the array
for(var i=0;i < cookieArray.length;i++)
{
var checkCookie = cookieArray[i];
// Remove any leading spaces
while (checkCookie.charAt(0)==' ')
{
checkCookie = checkCookie.substring
(1,checkCookie.length);
}

// Look for cookie set by key_value
if (checkCookie.indexOf(key_value) == 0)
{
null
// The cookie was found so set the variable
foundCookie = 1;
}
}
// Check if a cookie has been found
if ( foundCookie == 0)
{
// The key_value cookie was not found so set it now
document.cookie = key_value;
window.addEvent("domready", function() {
Slimbox.open('IMAGE SOURCE HERE');
});

}
</script>

So would anyone have a clue on what to do... I have spent ages Googleing and have not found anything yet. The webpages are PHP by the way.

Thanks

Jordan

Posted 2 weeks ago #
Top