J
jojowebdev
Do javascript cookies REALLY have to be this hard?
function setCookie( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+"="+escape( value ) +
( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) +
//expires.toGMTString()
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
I ONLY want a cookie that says a field name is nbcarrier1 for example.
Nothing else.
I want to call the cookie whatField.
I will hold it and squeeze it and love it and... eat the cookie.
I just want a simple cookie. I don't WANT it in its own function. I
already have a function.
Please help.
function setCookie( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+"="+escape( value ) +
( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) +
//expires.toGMTString()
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
I ONLY want a cookie that says a field name is nbcarrier1 for example.
Nothing else.
I want to call the cookie whatField.
I will hold it and squeeze it and love it and... eat the cookie.
I just want a simple cookie. I don't WANT it in its own function. I
already have a function.
Please help.