Set as the code of home page and favorite site, compatible with IE, chrome, firefox
//Set as Home Page function SetHome(obj,url){ try{ obj.style.behavior='url(#default#homepage)'; obj.setHomePage(url); }catch(e){ if(window.netscape){ try{ netscape.security. PrivilegeManager.enablePrivilege("UniversalXPConnect"); }catch(e){ Alert ("Sorry, this operation was browser Reject! \N n Please enter 'about: config' in the browser address bar and enter, then set [signed. applets. codebase_principal_support] to 'true' "); } }else{ Alert ("Sorry, the browser you are using cannot complete this operation. n nYou need to manually set ["+url+"] as the home page."); } } } //Collect this site function AddFavorite(title, url) { try { window.external.addFavorite(url, title); } catch (e) { try { window.sidebar.addPanel(title, url, ""); } catch (e) { Alert ("Sorry, the browser you are using cannot complete this operation. n nAdding a favorite failed, please use Ctrl+D to add it"); } } }
<a href="javascript: void (0);" onclick="SetHome (this, 'replace the domain name here');">Set as the home page</a> <a href="javascript: void (0);" onclick="AddFavorite ('Tuoyuan - an expert on customizing original websites around you! ', location. href)">Collect this site</a>
<a href="javascript: void (0)" onclick="SetHome (this, '<# ZC_BLOG_HOST #>');">Set as Home Page</a> <a href="javascript: void (0)" onclick="AddFavorite ('<# ZC_BLOG_NAME #>', location. href)">Collect this site</a>
Related articles
Fourteen problems that most headache PHP beginners Zblog top articles are only displayed on the home page CSS implementation of modifying the color and background color of the selected text on the web page Example of jquery price switching with specifications Method of unifying font size among browsers JAVASCRIPT judges password strength