以下代码在:IE,NetCaptor,Mozilla,腾讯TT,Mozilla Firefox,Opera使用通过;
给出代码先,呵呵
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>带cookie的提示页面</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META http-equiv="Pragma" content="no-cache">
<META content="MSHTML 6.00.3790.0" name="GENERATOR">
<style type="text/css">
<!--
#Layer1{
filter:Alpha(Opacity=80); /* 提示窗口背景透明度,数字越小越透明 */
font-size: 9pt; /* 字体大小 */
color: #0066CC;
border: 1px dashed #09F; /* 提示窗口边框类型,粗细和颜色 */
clear: both;
background-color: #FFF; /* 提示窗口背景颜色 */
text-align: center;
visibility: hidden; /* 层默认状态:隐藏 */
padding: 5px;
line-height: 15px; /* 行高 */
}
A:link, A:visited {
FONT-SIZE: 9pt; COLOR: #000; LINE-HEIGHT: 18px; LETTER-SPACING: 1px; TEXT-DECORATION: none
}
A:hover {
FONT-SIZE: 9pt; COLOR: #f60; LINE-HEIGHT: 18px; LETTER-SPACING: 1px; TEXT-DECORATION: none
}
-->
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
// 显示层
function showlayer(){
var DivNum=document.getElementById("Layer1");
if(DivNum.style.visibility='hidden'){
DivNum.style.visibility='visible';
}
else{
DivNum.style.visibility='hidden';
}
}
// 隐藏层
function hidelayer(){
var DivNum=document.getElementById("Layer1");
if(DivNum.style.visibility='visible'){
DivNum.style.visibility='hidden';
}
else{
DivNum.style.visibility='visible';
}
}
//自动关闭
function closeit() {
setTimeout("hidelayer()",15000) //更改相应的时间15000毫秒就是15秒
}
//cookie记录
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
//检查cookie
function ppcheck(){
if (get_cookie('pplive')==''){
showlayer()
document.cookie="pplive=ok"
}
}
-->
</SCRIPT>
</HEAD>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0" onLoad="ppcheck();closeit();"
onclick="hidelayer();">
<SPAN id="Layer1" style="position:absolute;; width:400px; height:300px; left: 100px; top: 30px;">
<strong>带cookie的提示页面</strong><br/>
随便点击窗口内为关闭窗口<br>
<a href="http://www.cnrui.cn">胡东平个人空间</a> 或者<a href="http://www.cnrui.cn/blog" target="_blank">
胡东平BLOG</a><br/>
<p><a href="javascript:hidelayer();">关闭页面</a>(15秒后页面自动关闭)</p>
</SPAN>
</BODY>
</HTML>
假如你不想记录cookie将下面的语句
onLoad="ppcheck();closeit();"
改为:
onLoad="showlayer();closeit();"
假如不想自动关闭提示窗口,去掉
[最后修改由 Clear, 于 2005-11-12 11:24:21]