httml代码: 复制代码 代码如下: Untitled Document Website1 Website2 Website3 Website4 記住我的選擇 JS代码: 复制代码 代码如下: <BR><!-- <BR>function getCookie(name){ <BR>if(document.cookie.length > 0){ <BR>start = document.cookie.indexOf(name + "="); <BR>if( start != -1){ <BR>start = start +name.length + 1; <BR>end = document.cookie.indexOf(";",start); <BR>if( end == -1){ <BR>end = document.cookie.length; <BR>} <BR>return decodeURI(document.cookie.substring(start,end)); <BR>} <BR>} <BR>return ""; <BR>} <BR>function setCookie(name, value, expires, path, domain, secure){ <BR>var curcookie = name + "=" +encodeURI(value) <BR>+ ((expires) ? ";expires=" + expires.toGMTString() : "") <BR>+ ((path) ? ";path=" + path : "") <BR>+ ((domain) ? ";domain=" + domain : "") <BR>+ ((secure) ? ";secure" : ""); <BR>document.cookie = curcookie; <BR>} <BR>function goHome( myhome ){ <BR>if (myhome){ <BR>switch(myhome){ <BR>case "dizhi1": <BR>window.location = "http://www.qq.com"; <BR>break; <BR>case "dizhi2": <BR>window.location = "http://zghlx.cnblogs.com"; <BR>break; <BR>case "dizhi3": <BR>window.location = "http://www.sina.com.cn"; <BR>break; <BR>case "dizhi4": <BR>window.location = "http://www.163.com"; <BR>break; <BR>} <BR>} <BR>} <BR>function setHome(myhome) { <BR>var today = new Date(); <BR>var expires = new Date(); <BR>expires.setTime(today.getTime()+ 365*24*60*60*1000); <BR>if(document.homeform.setgo.checked) { <BR>setCookie("home",myhome,expires); <BR>} <BR>goHome(myhome); <BR>} <BR>window.onload = function(){ <BR>var pHome = getCookie("home"); <BR>goHome(pHome); <BR>} <BR>--> <BR>