View Single Post
Old 12-10-2012, 07:52 PM   PM User | #7
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
I'm not sure what you are asking: is there a problem with your code, or is there something additional you are trying to achieve?

I notice this code in your first post:
Code:
document.cookie="Vln=" + this.value;
This creates a cookie but doesn't set an expiration, so it will be deleted when the browser is closed. Perhaps this is your issue(?).

In which case you probably want a function to set a cookie:

Code:
function setCookie( name, value, expires, path, domain, secure ) {
    // Sets the name/value pair - 'expires' is the number of days.
    var expires_date;
    if (expires) {
        expires_date = new Date();
        expires_date.setDate(expires_date.getDate() + expires);
    }
    document.cookie = name + "=" + value +
        ( ( expires ) ? ";expires=" + expires_date.toUTCString() : "" ) +
        ( ( path ) ? ";path=" + path : "" ) +
        ( ( domain ) ? ";domain=" + domain : "" ) +
        ( ( secure ) ? ";secure" : "" );
}
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 12-10-2012 at 07:55 PM..
AndrewGSW is offline   Reply With Quote