Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting multiple cookies using Javascript?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am trying to set multiple cookies using javascript. But the problem is: instead of creating a second cookie, the code appends it to the first one.

here is my code:

function SetCookie (name,value,expires) {
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires.toGMTString() : "");
}

var urlstring1 = "loaded=1"
var urlstring2 = "loaded=2"

expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); // 24 hrs from now

SetCookie ("urlcoded1", urlstring1, expdate);
SetCookie ("urlcoded2", urlstring2, expdate);


thank you in advance for your help.
campite
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top