网站设为首页和加入收藏JavaScript代码
来源:互联网 发布:matlab编程stephen 编辑:程序博客网 时间:2024/04/29 19:35
// JavaScript Document// 加入收藏 <a onclick="AddFavorite(window.location,document.title)">加入收藏</a>function AddFavorite(sURL, sTitle){ try { window.external.addFavorite(sURL, sTitle); } catch (e) { try { window.sidebar.addPanel(sTitle, sURL, ""); } catch (e) { alert("加入收藏失败,请使用Ctrl+D进行添加"); } }}//设为首页 <a onclick="SetHome(this,window.location)">设为首页</a>function SetHome(obj,vrl){ try{ obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl); } catch(e){ if(window.netscape) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。"); } var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage',vrl); } }}
使用
<a href="#" onclick="SetHome(this,window.location)" >设为首页</a>
<a href="#" onclick="AddFavorite(window.location,document.title)" >收藏本站</a>
0 0
- 网站设为首页和加入收藏JavaScript代码
- js几种将网站设为首页和加入收藏的代码
- 网站设为首页、加入收藏代码全集
- 设为首页和加入收藏的JavaScript代码
- javascript设为首页.加入收藏代码
- 设为首页代码和加入收藏代码
- 设为首页和加入收藏的代码
- c# 设为首页和加入收藏代码
- 加入收藏和设为首页JQuery代码
- 设为首页和加入收藏代码
- 设为首页和加入收藏(js代码)
- 设为首页和加入收藏代码。。。。
- 设为首页和加入收藏代码
- 设为首页,和加入收藏js代码
- 设为首页/加入收藏代码
- 设为首页/加入收藏代码
- 设为首页|加入收藏代码
- 加入收藏 设为首页 代码
- UTC时间与北京时间的差多久
- Eclipse CDT/CodeBlocks & MinGW & OpenCV 2.x 配置
- 从一个MFC工程移植对话框类到另一个MFC工程
- SpringMVC入门之普通配置篇
- Android 的权限设置大全
- 网站设为首页和加入收藏JavaScript代码
- 删除没有头结点的链表指点节点操作
- 田亮晒森碟与海豚亲吻照 父女开心超有爱
- Windows下用python备份MySQL数据库
- tornado websocket
- ASIHTTPRequest 详解
- sdadsa
- 典型的notification一例——“点击Notification,打开浏览器”
- 查看 MySQL 数据库中每个表占用的空间大小