jquery加入收藏代码
2014-01-23 11:21
453 查看
<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>
需要jquery-1.9.1.js的支持~! http://files.cnblogs.com/simpledev/jquery-1.9.1.js
相关文章推荐
- 设置主页_加入收藏JQuery代码
- jquery设为首页,加入收藏代码
- 加入收藏和设为首页JQuery代码
- 设置主页_加入收藏JQuery代码
- 设为首页代码和加入收藏代码-兼容各种浏览器
- 设为首页代码和加入收藏代码(兼容各种浏览器)
- javascript“设为首页”与“加入收藏”兼容多浏览器代码
- 设为首页 加入收藏的js代码
- 收藏很实用的jquery代码段
- 加入收藏的代码
- 兼容各类主流浏览器IE6、IE7、FF、Opera的加入收藏代码
- 设为首页 加入收藏(代码)
- 设为首页加入收藏兼容360/火狐/谷歌/IE/搜狗/猎狐/Safari/等主流浏览器的代码
- js几种将网站设为首页和加入收藏的代码
- JS兼容所有浏览器的一段加入收藏代码,设置为首页
- 设为首页加入收藏代码_兼容各浏览器ie系列Firefox
- 设为首页/加入收藏代码
- asp.net中加入收藏及设为首页代码
- jQuery+HTML5加入购物车代码分享