document.write('

 解析:

(1)encodeURI() 转换字符编码为统一编码(涉及中文编码)。
(2)toUTCString() 将时间转换为字符串,Cookie 只能接收字符串形式。
function setCookie(key, value, t) {
 var oDate = new Date();
 oDate.setDate(oDate.getDate() + t);
 document.Cookie = key + \'=\'+ encodeURI(value)
 +\';expires=\'+oDate.toUTCString();
}
');