转自:http://www.icdiary.com/html/2227.html
DOCTYPE html>
<html>
<head>
<meta charset&#61;"utf-8" />
<style type&#61;"text/css">
body,input,button,select,textarea{font:12px/1.5 Lucida Grande,Microsoft Yahei,Arial,Calibri,Trebuchet MS,Helvetica,Hiragino,STHeiti,Microsoft Jhenghei,sans-serif;color:#444}
.focus {
position: fixed;
right: 5px;
bottom: 5px;
z-index: 300;
overflow: hidden;
width: 250px;
border: 1px solid #AAA;
padding: 0 10px;
background: white;
}
.bm, .bn {
margin-bottom: 10px;
}
.bm_h {
padding: 0 10px;
height: 40px;
border-bottom: 4px solid #009AD9;
line-height: 40px;
white-space: nowrap;
overflow: hidden;
}
.cl {
zoom: 1;
}
.y {
float: right;
}
a {
color: #333;
text-decoration: none;
}
h1, h2, h3, h4, h5, h6 {
font-size: 1em;
}
body, ul, ol, li, dl, dd, p, h1, h2, h3, h4, h5, h6, form, fieldset, .pr, .pc {
margin: 0;
padding: 0;
}
.bm_c {
background: white;
}
.bbda {
border-bottom: 1px dashed #CDCDCD;
}
.cl {
zoom: 1;
}
.xld dt {
padding: 8px 0 5px;
font-weight: 700;
}
.bm_c h2 a, .bm_c dt a {
padding-right: 10px;
color: #4A4E52;
}
.focus dt a {
color: #0060A6;
font-size: 12px;
}
.xi2, .xi2 a, .xi3 a {
color: #266CB5;
}
.xld dd {
margin-bottom: 8px;
}
.hm {
text-align: center;
}
.ptn {
padding-top: 5px!important;
}
a:hover, * a:hover {
color: #F60 !important;
}
style>
<script src&#61;"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">script>
<script type&#61;"text/Javascript">
function setCOOKIE(name, value, days) {
if (days) {
var date &#61; new Date();
date.setTime(date.getTime() &#43; (days * 24 * 60 * 60 * 1000));
var expires &#61; "; expires&#61;" &#43; date.toGMTString();
} else {
var expires &#61; "";
}
document.COOKIE &#61; name &#43; "&#61;" &#43; value &#43; expires &#43; "; path&#61;/";
}
function getCOOKIE(name) {
var nameEQ &#61; name &#43; "&#61;";
var ca &#61; document.COOKIE.split(&#39;;&#39;);
for (var i &#61; 0; i < ca.length; i&#43;&#43;) {
var c &#61; ca[i];
while (c.charAt(0) &#61;&#61; &#39; &#39;) {
c &#61; c.substring(1, c.length);
}
if (c.indexOf(nameEQ) &#61;&#61; 0) {
return c.substring(nameEQ.length, c.length);
}
}
return null;
}
script>
<script>
$(document).ready(function() {
if(getCOOKIE("nofocus_8")&#61;&#61;1){
$(&#39;#sitefocus&#39;).css(&#39;display&#39;,&#39;none&#39;);
}else{
$(&#39;#sitefocus&#39;).css(&#39;display&#39;,&#39; &#39;);}
});
script>
head><body>
<br><br>
此例子启用了COOKIE记录&#xff0c;在这一窗口中&#xff0c;只要没有关闭网页点击关闭产生的COOKIE一直存在&#xff0c;此时无论怎么刷新都不会出现。点击清除COOKIE后刷新网页可以让关闭的关闭的窗口显示。<br><br>
<a href&#61;"Javascript:;" onclick&#61;"setCOOKIE(&#39;nofocus_8&#39;,2,1*3600);$(&#39;#sitefocus&#39;).css(&#39;display&#39;,&#39; &#39;);" title&#61;"COOKIE"><font color&#61;red>清除COOKIEfont>a>
<div class&#61;"focus" id&#61;"sitefocus" >
<div class&#61;"bm">
<div class&#61;"bm_h cl">
<a href&#61;"Javascript:;" onclick&#61;"setCOOKIE(&#39;nofocus_8&#39;,1,1*3600);$(&#39;#sitefocus&#39;).css(&#39;display&#39;,&#39;none&#39;);" class&#61;"y" title&#61;"关闭">关闭a>
<h2>临时公告h2>
div>
<div class&#61;"bm_c">
<dl class&#61;"xld cl bbda">
<dt><a href&#61;"#" class&#61;"xi2" target&#61;"_blank">畅游论坛之新手指南a>dt>
<dd>漫游论坛、新手必备之良品。请新注册会员仔细阅读本指南以尽快融入论坛。dd>
dl>
<p class&#61;"ptn hm"><a href&#61;"#" class&#61;"xi2" target&#61;"_blank">查看 »a>p>
div>
div>
div>
body>html>
<html>
<head>
<meta charset&#61;"utf-8" />
<style type&#61;"text/css">
body,input,button,select,textarea{font:12px/1.5 Lucida Grande,Microsoft Yahei,Arial,Calibri,Trebuchet MS,Helvetica,Hiragino,STHeiti,Microsoft Jhenghei,sans-serif;color:#444}
.focus {
position: fixed;
right: 5px;
bottom: 5px;
z-index: 300;
overflow: hidden;
width: 250px;
border: 1px solid #AAA;
padding: 0 10px;
background: white;
}
.bm, .bn {
margin-bottom: 10px;
}
.bm_h {
padding: 0 10px;
height: 40px;
border-bottom: 4px solid #009AD9;
line-height: 40px;
white-space: nowrap;
overflow: hidden;
}
.cl {
zoom: 1;
}
.y {
float: right;
}
a {
color: #333;
text-decoration: none;
}
h1, h2, h3, h4, h5, h6 {
font-size: 1em;
}
body, ul, ol, li, dl, dd, p, h1, h2, h3, h4, h5, h6, form, fieldset, .pr, .pc {
margin: 0;
padding: 0;
}
.bm_c {
background: white;
}
.bbda {
border-bottom: 1px dashed #CDCDCD;
}
.cl {
zoom: 1;
}
.xld dt {
padding: 8px 0 5px;
font-weight: 700;
}
.bm_c h2 a, .bm_c dt a {
padding-right: 10px;
color: #4A4E52;
}
.focus dt a {
color: #0060A6;
font-size: 12px;
}
.xi2, .xi2 a, .xi3 a {
color: #266CB5;
}
.xld dd {
margin-bottom: 8px;
}
.hm {
text-align: center;
}
.ptn {
padding-top: 5px!important;
}
a:hover, * a:hover {
color: #F60 !important;
}
style>
<script src&#61;"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">script>
<script type&#61;"text/Javascript">
function setCOOKIE(name, value, days) {
if (days) {
var date &#61; new Date();
date.setTime(date.getTime() &#43; (days * 24 * 60 * 60 * 1000));
var expires &#61; "; expires&#61;" &#43; date.toGMTString();
} else {
var expires &#61; "";
}
document.COOKIE &#61; name &#43; "&#61;" &#43; value &#43; expires &#43; "; path&#61;/";
}
function getCOOKIE(name) {
var nameEQ &#61; name &#43; "&#61;";
var ca &#61; document.COOKIE.split(&#39;;&#39;);
for (var i &#61; 0; i < ca.length; i&#43;&#43;) {
var c &#61; ca[i];
while (c.charAt(0) &#61;&#61; &#39; &#39;) {
c &#61; c.substring(1, c.length);
}
if (c.indexOf(nameEQ) &#61;&#61; 0) {
return c.substring(nameEQ.length, c.length);
}
}
return null;
}
script>
<script>
$(document).ready(function() {
if(getCOOKIE("nofocus_8")&#61;&#61;1){
$(&#39;#sitefocus&#39;).css(&#39;display&#39;,&#39;none&#39;);
}else{
$(&#39;#sitefocus&#39;).css(&#39;display&#39;,&#39; &#39;);}
});
script>
head><body>
<br><br>
此例子启用了COOKIE记录&#xff0c;在这一窗口中&#xff0c;只要没有关闭网页点击关闭产生的COOKIE一直存在&#xff0c;此时无论怎么刷新都不会出现。点击清除COOKIE后刷新网页可以让关闭的关闭的窗口显示。<br><br>
<a href&#61;"Javascript:;" onclick&#61;"setCOOKIE(&#39;nofocus_8&#39;,2,1*3600);$(&#39;#sitefocus&#39;).css(&#39;display&#39;,&#39; &#39;);" title&#61;"COOKIE"><font color&#61;red>清除COOKIEfont>a>
<div class&#61;"focus" id&#61;"sitefocus" >
<div class&#61;"bm">
<div class&#61;"bm_h cl">
<a href&#61;"Javascript:;" onclick&#61;"setCOOKIE(&#39;nofocus_8&#39;,1,1*3600);$(&#39;#sitefocus&#39;).css(&#39;display&#39;,&#39;none&#39;);" class&#61;"y" title&#61;"关闭">关闭a>
<h2>临时公告h2>
div>
<div class&#61;"bm_c">
<dl class&#61;"xld cl bbda">
<dt><a href&#61;"#" class&#61;"xi2" target&#61;"_blank">畅游论坛之新手指南a>dt>
<dd>漫游论坛、新手必备之良品。请新注册会员仔细阅读本指南以尽快融入论坛。dd>
dl>
<p class&#61;"ptn hm"><a href&#61;"#" class&#61;"xi2" target&#61;"_blank">查看 »a>p>
div>
div>
div>
body>html>