I'm trying to use jquery to do some things. It works well, but I can't seem to get it to set a cookie that doesn't expire when I end the browser session.
The books and examples say this should work:
Expand|Select|Wrap|Line Numbers
- function CheckPW(){
- var PWDiv = document.getElementById("PWDiv");
- var Uname = document.getElementById("UserName");
- var Pword = document.getElementById("PassWord");
- var MyUser=Uname.value;
- var MyUN=Uname.value;
- var MyPW=Pword.value;
- for (var x in User) {
- //PWDiv.innerHTML += x + " " + User[x] + "<br>";
- if(MyUN == x) {
- if(MyPW == User[x]){
- PWDiv.innerHTML += " Logged In as " + x + "<br>";
- $.cookies.set("PWCookie", x, {expires: 15});
- }
- } else {
- //PWDiv.innerHTML += "Oh, well... <br>";
- }
- }
- }
- function LogInit(){
- logcookie = $.cookies.get("PWCookie");
- var Uname = document.getElementById("UserName");
- //alert(logcookie);
- Uname.value = logcookie;
- }
When I close the browser, the cookie disappears.
One other thing... the web page and scripts are contained in a folder on my local machine. Do these have to be on a server (a bona fide web server) to work?
Any Thoughts???
Sincerely,
Ken