Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
Help! How to create a cookie by javascript???
Logged in as: Guest
arrSession:exec spGetSession 2,7,417
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[General Forum]
>>
Other Programming/Scripting Languages
>> Help! How to create a cookie by javascript???
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
Help! How to create a cookie by javascript??? -
10/3/2001 7:06:31 AM
milkcat
Posts: 3
Score: 0
Joined: 10/2/2001
From:
Status:
offline
Original message moved by TNO
Reason :
Hi.. i am trying to create a cookie for the username..so everytime the user go into the site from same browser no need to type in their username, only the password.
Post #: 1
Re: Help! How to create a cookie by javascript??? -
10/3/2001 3:01:42 PM
imav8n
Posts: 95
Score: 0
Joined: 7/3/2001
From: USA
Status:
offline
Rather than cutting/pasting the code...here is a link to find what you are looking for:
http://javascript.internet.com/cookies/name.html
The site
http://javascript.internet.com
has many examples of code which are avaialable to cut/paste to perform a variety of functions.
Good Luck!
~imav8n
(in reply to
milkcat
)
Post #: 2
RE: Re: Help! How to create a cookie by javascript??? -
3/19/2008 10:11:21 AM
TNO
Posts: 974
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status:
offline
Put this in a separate library, or at the top of your page. Here is the API:
Cookie.getCookie(name)
Cookie.deleteCookie(name,path,domain)
Cookie.setCookie(ame,value,expires,path,domain,secure)
var Cookie = (function (){ return { getCookie : function(name){ var start = document.cookie.indexOf(name + "="); 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)); }, deleteCookie : function (name,path,domain) { if (Cookie.getCookie(name)) { document.cookie = name + '=' + ((path) ? ';path=' + path : '') + ((domain) ? ';domain=' + domain : '') + ';expires=Thu, 01-Jan-1970 00:00:01 GMT'; } }, setCookie : function(name,value,expires,path,domain,secure){ var today = new Date(); if(expires){ expires = expires*1000*60*60*24; } var expires_date = new Date(today.getTime() + (expires)); name = name; value = escape(value); expires = ((expires) ? ";expires=" + expires_date.toGMTString() : ""); path = ((path) ? ";path=" + path : ""); domain = ((domain) ? ";domain=" + domain : ""); secure = ((secure) ? ";secure" : ""); today.setTime(today.getTime()); document.cookie = name + "=" + value + expires + path + domain + secure; } } })();
_____________________________
Consolidated Script Component:
Now in Testing stage!
A universe of complexity...
(in reply to
imav8n
)
Post #: 3
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[General Forum]
>>
Other Programming/Scripting Languages
>> Help! How to create a cookie by javascript???
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI