if (getCookie("guidance") == null) {
document.cookie = "guidance=true";
window.location.href = "/default.html";
} function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}

以上js代码实现的是通过cookie记录是否第一次访问首页来决定是否跳转到引导页面.

以下代码实现的是引导页自动跳转回首页:

<meta http-equiv="Refresh" content="40; url=/" />
var t = 40;
function fun() {
t--;
if (t <= 0) {
location.href = "/";
clearInterval(inter);
}
}
var inter = setInterval("fun()", 1000);
05-04 01:52