Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
going nuts over a simple cookie script
Old 05-23-2009, 11:08 AM going nuts over a simple cookie script
theohoutman's Avatar
Skilled Talker

Posts: 96
Name: Theo Houtman
Location: Netherlands
Trades: 0
Can someone please explain te me why this won't work:

Quote:
<html>
<head>
<title>Cookie Test Script by Theo Houtman</title>
<script type="text/javascript">
function setCookie()
{
document.cookie = 'name=john; expires=15/02/2003 00:00:00';
}

function checkCookie()
{
username = getCookie('name');
if (username != null && username != "")
{
alert('Welcome ' + username + '!');
}
}

</script>
</head>
<body>

<a href="javascript:setCookie()">Set the cookie</a>

<br><br>

<a href="javascript:checkCookie()">Test the cookie</a>
</body>
</html>
This should be working???
theohoutman is offline
Reply With Quote
View Public Profile Visit theohoutman's homepage!
 
 
Register now for full access!
Old 05-26-2009, 05:59 AM Re: going nuts over a simple cookie script
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
for one, there's no getCookie function.
2nd, you are trying to set a cookie that expires in the past. So, it's expired.

Take a look at the solution in this post:
http://www.webmaster-talk.com/javasc...ing-saved.html
__________________

Please login or register to view this content. Registration is FREE

willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 05-26-2009, 06:59 AM Re: going nuts over a simple cookie script
theohoutman's Avatar
Skilled Talker

Posts: 96
Name: Theo Houtman
Location: Netherlands
Trades: 0
****! Do I feel stupid.....
theohoutman is offline
Reply With Quote
View Public Profile Visit theohoutman's homepage!
 
Reply     « Reply to going nuts over a simple cookie script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30557 seconds with 12 queries