Copy Code code as follows:
<script type= "Text/javascript" >
function Addfavorite (sURL, Stitle) {
try {
Window.external.addFavorite (sURL, stitle);
}
catch (e) {
try {
Window.sidebar.addPanel (Stitle, sURL, "");
}
catch (e) {
Alert ("Join collection failed, please use Ctrl+d to add");
}
}
}
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 ("This operation is rejected by the browser!") \ nplease type "About:config" in the browser address bar and enter \ n then set the value of [Signed.applets.codebase_principal_support] to ' true ' and double-click. ");
}
var prefs = components.classes[' @mozilla. Org/preferences-service;1 '].getservice ( Components.interfaces.nsIPrefBranch);
Prefs.setcharpref (' Browser.startup.homepage ', VRL);
}
}
}
</script>
Copy Code code as follows:
* <a onclick= "sethome (this,window.location)" style= "Cursor:pointer;" > Homepage </a> *<a
onclick= "Addfavorite (window.location,document.title)" style= "Cursor:pointer;" > Favorites this site </a>
This is OK, the small partners can be used directly to their own projects.