收藏/不再提醒

 1  <script>
 2 if ($.cookie("NLRAF") == null) {
 3     if (!$("#afps").length) {
 4         $("head").append('<style id="afps" type="text/css" media="screen">#afp{background-color:#ffe;border-bottom:1px solid #ddd;}#afp .afpc{width:960px;margin-left:auto;margin-right:auto;position:relative}#afp p{text-align:center;height:32px;line-height:32px}#afp .afpa{color:#09c;font-family:Arial;}#af{font-weight:bold;}#cafp{position:absolute;right:10px;top:8px;width:16px;height:16px;overflow:hidden;text-indent:-9999em;background:url(share_close.png) no-repeat 3px 3px}#cafp:hover{background-position:-30px 3px}#nlraf{color:#999;text-decoration:underline}</style>')
 5     }
 6 
 7     if (!$("#afp").length) {
 8         $("body").prepend('<div id="afp"><div class="afpc"><p>按 <span class="afpa">Ctrl + D</span> 把百度 <a id="af" class="afpa" href="javascript:void(0)" onclick="addFavorite(true)">加入收藏夹</a>,下次访问更方便!<a id="nlraf" href="javascript:void(0)" onclick="CloseNLRAF(true)">不再提醒</a></p><a id="cafp" href="javascript:void(0)" onclick="CloseNLRAF(false)">&times;</a>    </div></div>')
 9     }
10 }
11 
12 function addFavorite(b) {
13     CloseNLRAF(true);
14     var a = null;
15     if (b == "childreTop") {
16         var a = "http://baidu.com"
17     } else {
18         var a = location.href + (b == true ? "?from=topfavorite": "")
19     }
20     if ($.browser.msie) {
21         window.external.addFavorite(a, "把百度")
22     } else {
23         if ($.browser.mozilla) {
24             window.sidebar.addPanel("把百度", a, "")
25         } else {
26             alert("请按键盘 CRTL键 + D 收藏把百度")
27         }
28     }
29     return false
30 }
31 function CloseNLRAF(a) {
32     if (a) {
33         $.cookie("NLRAF", "true", {
34             path: "/",
35             expires: 30,
36             domain: _domain
37         })
38     } else {
39         $.cookie("NLRAF", "true", {
40             path: "/",
41             domain: _domain
42         })
43     }
44     $("#afp").slideUp()
45 }
46 </script>

 

posted @ 2016-08-05 09:28  于思若梦  阅读(162)  评论(0编辑  收藏  举报