•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 362,337 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,541 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 23932 | Replies: 2
![]() |
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
•
•
Join Date: Dec 2006
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
There are more ways to do it than just cookies - it basicaly depends if you want to store the session between visits that happend at the same time, or if you want to save sessions for later use.
If the later is what you want, go for cookies:
If you just want to save the session while the user leaves your pages you could use a hidden frame and store the session value inside a hidden input.
If the later is what you want, go for cookies:
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
If you just want to save the session while the user leaves your pages you could use a hidden frame and store the session value inside a hidden input.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Inserting dynamic values into Javascript variables (JavaScript / DHTML / AJAX)
- How to transfer values between ASP.NET pages (ASP.NET)
- Mouse events, xml values and Javascript (RSS, Web Services and SOAP)
- How to pass the values of javascript in perl (JavaScript / DHTML / AJAX)
- How to call a ServerSide Script through Javascript (ASP.NET)
- Session variable (ASP.NET)
- Save the values of a form (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Request for javascript based editor
- Next Thread: AJAX : Am i right with the concept?



Linear Mode