View Full Version : onload function based on cookie
mrtom18635
05-13-2010, 07:40 PM
I want to know how to do <body onload="xxxx.xxxxxxxxx(true)"> based on a cookie. Basically if the cookie is not present complete this function. Or the opposite if the cookie is present do not do it. Any help is appreciated
SOJO web
05-13-2010, 10:48 PM
mrtom,
Are you using PHP?
If so, you could write a simple PHP if statement like this:
<?php if ($_COOKIE['myCookie'] == "desiredAnswer") { ?>
<body onload="desiredScript">
<?php } else { ?>
<body>
<?php } ?>
Cheers,
Brian
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.