惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
H
Help Net Security
P
Privacy & Cybersecurity Law Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Help Net Security
Help Net Security
Hugging Face - Blog
Hugging Face - Blog
D
Docker
Security Archives - TechRepublic
Security Archives - TechRepublic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V2EX - 技术
V2EX - 技术
人人都是产品经理
人人都是产品经理
L
LINUX DO - 最新话题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google Online Security Blog
Google Online Security Blog
博客园 - 聂微东
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Latest news
Latest news
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Blog — PlanetScale
Blog — PlanetScale
C
Cisco Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
Webroot Blog
Webroot Blog
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
Recent Commits to openclaw:main
Recent Commits to openclaw:main
The Register - Security
The Register - Security
Simon Willison's Weblog
Simon Willison's Weblog
A
Arctic Wolf
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
Y
Y Combinator Blog
Last Week in AI
Last Week in AI
S
Securelist
Cloudbric
Cloudbric
G
GRAHAM CLULEY
M
MIT News - Artificial intelligence
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
Visual Studio Blog
S
Schneier on Security
Engineering at Meta
Engineering at Meta

博客园 - 王国营的博客

asp.net Handler中的IsReusable属性及在Handler中使用Session 关于Asp.Net中避免用户连续多次点击按钮,重复提交表单的处理 一道面试题 多层循环的递归实现 约瑟夫环问题 不通过第三个变量实现两个整型变量的交换 将PHP文件生成静态文件源码 PHP Warning: date(): It is not safe to rely on the system's timezone settings EcShop 如何制作一张windows sp3启动安装盘iso? win7下xp mode IP在同一网段实现网络共享 sql server 2005附加数据库错误 无法打开物理文件 解决114啦源码(114la)不能生成地方房产和地方报刊问题4级页面0字节 菜鸟学PHP之Smarty入门(组图) EMS SQL Manager中文显示乱码的解决方法 未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”提供程序 CSS和JS链接地址中带的问号是做什么的 IIS7/IIS7.5下轻松配置PHP利器(微软PHP Manager for IIS 7) iframe异步加载技术及性能 新开网址导航网站,欢迎各位朋友捧场
弹出一次“设为主页”和“加入收藏”代码
王国营的博客 · 2011-12-09 · via 博客园 - 王国营的博客

欢迎访问 http://www.5i321.com/

发现两个非常棒的“设为主页”和“加入收藏”代码,记录cookies,24小时只弹出一次。代码本站都测试过,在IE下都有效,站长朋友们应该能用得上。可以用"html转换成js"工具进行转换,用JS插入页面。

记录cookies实现退出弹出“设为主页”代码

<script>
function getCookie(name) {
var start =
document.cookie.indexOf( name + "=" );
var len = start + name.length +
1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
return null;
}
if ( start == -1 ) return
null;
var end = document.cookie.indexOf( ';', len );
if ( end == -1 ) end
= document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
function
SetCookie(name,value)//两个参数,一个是cookie的名子,一个是值
{
    var Days = 1; //此
cookie 将被保存 1 天
    var exp = new Date();   
   
exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name +
"="+ escape (value) + ";expires=" + exp.toGMTString();
}
function
setpage(aa,str){
//注意,只对IE有效,FF需要修改浏览器设置
aa.style.behavior="url(#default#homepage)";
var
bb=getCookie("username");   //读取cookies
if
(bb!='easyplay8er')
{
aa.setHomePage(str);
SetCookie("username","easyplay8er");
}
}
</script>
<body
onclick="setpage(this,'http://www.5i321.com/');">
</body>

记录cookies实现退出弹出“加入收藏”代码

<script language="javascript"
type="text/javascript">
function
bookmark()
{
if(readCookie("bookmark")!="yes")

{
saveCookie("bookmark","yes",1);
window.external.AddFavorite('http://www.5i321.com/',
'腊月的白菜');
}
}

function saveCookie(name,value,days) {
    if (days)
{
        var date = new Date();
       
date.setTime(date.getTime()+(days*24*60*60*1000))
        var expires = ";
expires="+date.toGMTString()
    }
    else expires = ""
   
document.cookie = name+"="+value+expires+"; path=/"
}
function
readCookie(name) {
    var nameEQ = name + "="
    var ca =
document.cookie.split(';')
    for(var i=0;i<ca.length;i++) {
       
var c = ca[i];
        while (c.charAt(0)==' ') c =
c.substring(1,c.length)
        if (c.indexOf(nameEQ) == 0) return
c.substring(nameEQ.length,c.length)
    }
    return
null
}
</script>
<body
onUnload="bookmark()">
</body>