473,466 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

java script needed for setting the cookies

5 New Member
i want java script on how the remember me on this computer works on website please help..............!
Jun 25 '07 #1
1 1004
shoonya
161 New Member
Expand|Select|Wrap|Line Numbers
  1. function set_cookie( name, value, expires, path, domain, secure ) 
  2. {
  3. // set time, it's in milliseconds
  4. var today = new Date();
  5. today.setTime( today.getTime() );
  6.  
  7. /* if the expires variable is set, make the correct expires time, the current script below will set it for x number of days, to make it for hours, 
  8. delete * 24, for minutes, delete * 60 * 24 */
  9. if ( expires )
  10. { expires = expires * 1000 * 60 * 60 * 24; }
  11. var expires_date = new Date( today.getTime() + (expires) );
  12.  
  13. document.cookie = name + "=" +escape( value ) +
  14. ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
  15. ( ( path ) ? ";path=" + path : "" ) + 
  16. ( ( domain ) ? ";domain=" + domain : "" ) +
  17. ( ( secure ) ? ";secure" : "" );
  18. }
  19.  
  20. function get_cookie( name ) {
  21.  
  22. var start = document.cookie.indexOf( name + "=" );
  23. var len = start + name.length + 1;
  24. if ( ( !start ) &&
  25. ( name != document.cookie.substring( 0, name.length ) ) )
  26. {
  27. return null;
  28. }
  29. if ( start == -1 ) return null;
  30. var end = document.cookie.indexOf( ";", len );
  31. if ( end == -1 ) end = document.cookie.length;
  32. return unescape( document.cookie.substring( len, end ) );
  33. }

hope this helps

shoonya
Jun 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
2
by: rookiejavadude | last post by:
I'm have most of my java script done but can not figure out how to add a few buttons. I need to add a delete and add buttong to my existing java program. Not sure were to add it on how. Can anyone...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.