Forum Moderators: open

Message Too Old, No Replies

Setting a cookie inside a function not working

Quick code review?

         

trillianjedi

7:18 pm on Aug 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

This function:-

function setHkey(hkey_value) {
var myapplet = document.getElementById('the_applet');
myapplet.sethkey(hkey_value);
setCookie('hkey', hkey_value, '365');
return true;
}

Does everything I want it to (so I can see the function is getting called), other than set the cookie.

Just wondering if there's something really obvious that I'm missing (tired eyes). Would appreciate borrowing your fresh set!

Thanks....

whoisgregg

7:21 pm on Aug 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What does your setCookie function look like?

Added It may be as simple as your setCookie() function is expecting the expire_days to be an integer instead of a string. Remove the single quotes from around the "365" and it might just work. Otherwise, post back the setCookie() function so we can take a look at that. :)

trillianjedi

9:35 pm on Aug 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




What does your setCookie function look like?

DOH!

Thank you - I knew I needed a new set of eyes. There isn't one - must have got deleted... that'll be the problem!

Thanks ;)

whoisgregg

11:39 pm on Aug 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Happy to help. :)