首页 > Web开发 > 详细

jquery加入收藏代码

时间:2014-01-23 19:59:41      阅读:416      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
<html>
<head>
    <script type="text/javascript" src="jquery-1.9.1.js"></script>

    <script type="text/javascript">
        $(function(){
            var basePath = $("#basePath").val();
            //收藏本站
            $("#favorites").click(function () {        //$里面是链接的id  
                var ctrl = (navigator.userAgent.toLowerCase()).indexOf(mac) != -1 ? Command/Cmd : CTRL;  
                if (document.all) {  
                    window.external.addFavorite(basePath, 优一队列);
                } else if (window.sidebar) {  
                    window.sidebar.addPanel(优一队列, basePath, "");
                } else {    //添加收藏的快捷键  
                       alert(添加失败\n您可以尝试通过快捷键 + ctrl +  + D 加入到收藏夹~);
                }
            });
            
            });
    
    </script>  
</head>
<body>

<a href="#" id="favorites">收藏本站</a>

<input type="hidden" name="basePath" id="basePath" value="http://www.youyidl.com" />

</body>
</html>
bubuko.com,布布扣

需要jquery-1.9.1.js的支持~! http://files.cnblogs.com/simpledev/jquery-1.9.1.js

jquery加入收藏代码

原文:http://www.cnblogs.com/simpledev/p/3530877.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!