The expires parameter was part of the original cookies baked up by Netscape. In HTTP version 1.1, expires was deprecated and replaced with the easier-to-use max-age—instead of having to specify a date, you can just say how long the cookie can live. By setting either of these, the cookie will persist until its time runs out, otherwise—if you set neither—the cookie will last until you close your browser (a “session cookie”).
Setting a cookie for “foo=bar” to last 5 minutes, using expires:
d = ();
d.setTime(d.getTime() + * * );
.cookie = +d.toGMTString()+ ;
And the same with max-age:
document.' bar; /; '+ * +';';
Unfortunately, none of the current versions of Internet Explorer support max-age, so if you want proper cookie persistence cross-browser, then stick to expires.