473,769 Members | 3,329 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

save cookie and retrieve in javascript

oranoos3000
107 New Member
hi
i want to set cookie with javascript
i use this code
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. document.cookie="username='ali'";
  3.  
  4. </script>
with using this code when i look at previous cookie that stored in my computer
i dont this cookie
how do save cookie and retrieve with javasript?
thanks alot for your help
Jun 25 '09 #1
1 5783
acoder
16,027 Recognized Expert Moderator MVP
To deal with cookies easily, you need three functions: to save, read and delete. Here are two links which should help:
http://www.quirksmode.org/js/cookies.html
http://www.w3schools.com/JS/js_cookies.asp

PS: use the script type attribute, not the deprecated language attribute:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
Jun 26 '09 #2

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

Similar topics

0
2585
by: Phil Powell | last post by:
URL: http://valsignalandet.com/cookiegrab.php?name=valIdentifier This page produces a cookie value and sends it back as HTML using PHP and Javascript to obtain it. This URL will be used as the value for a URLConnection object in a Java class to obtain the results of this page to get, of all things, a cookie value. Simply put: it's the ONLY way I know of where I can use Java to ultimately obtain a cookie since this is an application...
17
1845
by: neerolyte | last post by:
how would i go about setting a cookie in javascript that can be read in javascript on the next page load, but will NOT be passed to the server?
3
5976
by: M Wells | last post by:
Hi All, Just wondering how you go about changing the value of a session cookie via javascript? I have a PHP page that sets a session cookie when it first loads. I'd like to be able to change the value of that session cookie in response to a button click in a form, without resubmitting the page. For some reason, the following doesn't seem to work:
4
2394
by: Larsens | last post by:
Hello I have this in a FORM tag: OnSubmit="return SendForm(this); to save the content of the form in a cookie. But I need to save it a on windows print, where I reload the form with a css for print. Therefore the form must be filled in again from the cookie. But how do I save the form without submitting ? I retrieve the saved data with:
9
4500
by: Marco Krechting | last post by:
Hi All, I have a page with a list of hyperlinks. I want to save information in a cookie about the fact that I entered an hyperlink or not. When I click one of the hyperlinks I want this stored in a cookie and a small bullit shown in front of the hyperlink, so when I reload the page I can immediately see which hyperlinks I already visited that day.
14
3384
by: Schoo | last post by:
I have an asp.net app that uses session objects (ag. session("UserID")). The app works fine in development/debug mode. I released it to the test server (Windows 2000 server with other .NET applications running on it) and when I am sitting at that server running the application, it also runs fine. But, if I sit at any workstation on the LAN it does not work. I narrowed the problem down to the fact that all of the session objects contain...
2
1392
by: Raghu Raman | last post by:
Hi, In javascript file i store 3 values under a single cookie array ,like var myarray = new Array(null); myarray = "field_1"; myarray = "field_2"; myarray = "field_3"; document.cookie ="myarray=" + myarray;
2
5326
by: Josh T | last post by:
As of now I am setting a cookie on my aspx page via javascript, function SetCookie(cookieName, value, minutesToExpire) { ClearCookie(cookieName); var expireDate = new Date(); var cookieValue; expireDate.setMinutes(expireDate.getMinutes() + minutesToExpire);
2
3193
by: mlevit | last post by:
Hi, I've written my own JavaScript and used a couple of codes to set and get cookies from the net I found. When I set the cookie I can see it in my browser, it is set with the right value and expiration date etc. The only problem I'm getting is when I retrieve the cookie the value is always NULL. // ==UserScript== // @name Utopia Login/Loged // @namespace http://games.swirve.com/utopia/login.htm // @description Logs...
0
9587
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9993
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7406
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.