473,395 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

writing multiple values to a cookie

I want to save links to a cookie. So far I can save one link by:

var value=document.getElementById("link1").href;
document.cookie=cookiename + "=" + escape(value);

If I want to save several links, do I have to create one cookie per link or can I save them all in the same cookie? If I can use only one cookie, how do I read the values from it?

Thanks in advance!
Mar 21 '07 #1
1 2232
iam_clint
1,208 Expert 1GB
you can write to your cookie using a dilimeter such as | or ;

Example:
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. var b = "www.google.com|www.yahoo.com|www.thescripts.com";
  3. b = b.split("|");
  4. for (i=0; i<=b.length; i++) {
  5. alert(b[i]);
  6. }
  7. </script>
  8.  
Mar 21 '07 #2

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

Similar topics

16
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
0
by: Nicolas Joly | last post by:
Hello, I have this (a cookie writer) <script runat="server"> void WriteClicked(Object Sender, EventArgs e) { //Create a new cookie, passing the name into the constructor HttpCookie cookie =...
0
by: tshad | last post by:
I can add a cookie fine, but I can't seem to figure out how to change the value of a cookie and save it back. My code looks like: if (passwordSaveCookie.checked) then If...
1
by: SamG | last post by:
Hello, Does anyone know how I can Write a Cookie and then later retrieve it...? Also, Is it possible to write attributes and corresponding values to the cookie file.Needless to say would require...
6
by: thomson | last post by:
Hi All, i do hae a solution in which i do have mulitple projects including Web Projects,, Depending on the functionality it gets redirected to different web projects and it is working fine, ...
0
by: g.o.atkins | last post by:
Hi, Is there anyway to store multiple values in the System.Net.Cookie object?? I cannot use the System.Web.HttpCookie object (which allows for multiple values) as I am trying to set the...
5
by: piedpiper | last post by:
I am coding a http proxy in c# and using httpwebrequest class to send request to the web server, when the server returns multiple set-cookie headers then the httpwebresponse object combines them all...
1
by: domnicx | last post by:
Hi, I am using the httpweblistener class to build a web server kinda functionality. I have to send multiple set-cookie headers in a single response when queried for a particular request and i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
0
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...

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.