Forum Moderators: open
That's all I need, but for some reason I can't figure it out, and keep getting errors. I'm pulling my hair out here, can anyone give me the code I need? I'll be eternally grateful!
<script language=javascript>// Enter number of days the cookie should persist
var expDays = 300;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000));
expirationDate = exp.toGMTString();
// Set cookie with name and value provided
// in function call and date from above
document.cookie = "market_reports;"
document.cookie += '; expires=' + exp.toGMTString();
</script>
and then to check for that I was trying:
<script language="JavaScript" type="text/javascript">
<!--function Get_Cookie(market_reports) {
var start = document.cookie.indexOf( market_reports+ "=" );
var len = start + name.length + 1;
if ( (!start ) &&
( name!= document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}if (market_reports == 'TRUE') {
window.location=("http://yahoo.com");
}//-->
</script>