Add a favorite feature to your Web page

Source: Internet
Author: User

<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Add to Favorites Set homepage</title></Head><Body><Scripttype= "Text/javascript"> //Set as Home pagefunctionSethome (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 action was rejected by the browser! \ n Please enter "About:config" in the browser address bar and return to \ n then set the value of [Signed.applets.codebase_principal_support] to ' true ' and double click. "); } varprefs=components.classes['@mozilla. Org/preferences-service;1'].getservice (Components.interfaces.nsIPrefBranch); Prefs.setcharpref ('Browser.startup.homepage', VRL); }Else{alert ("your browser is not supported, follow these steps: 1. Open the browser settings. 2. Click on the Settings page. 3. Enter:"+VRL+"Click OK. "); } } } //Add to Favorites compatible with 360 and IE6functionShoucang (stitle,surl) {Try{window.external.addFavorite (sURL, stitle);}Catch(e) {Try{Window.sidebar.addPanel (Stitle, sURL,""); } Catch(e) {alert ("add to collection failed, please use ctrl+d"); } } } </Script>  <Liclass= "Fore1"><ahref= "javascript:void (0)"onclick= "Sethome (this,window.location)">Set as homepage</a></Li> <Liclass= "GE">|</Li> <Liclass= "Fore2"><ahref= "javascript:void (0)"onclick= "Shoucang (document.title,window.location)">Add to Favorites</a></Li> <Liclass= "GE">|</Li>  </Body></HTML>

First, copy the JS code to the page where you want to add the favorite features:

<Scripttype= "Text/javascript"> //Set as Home pagefunctionSethome (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 action was rejected by the browser! \ n Please enter "About:config" in the browser address bar and return to \ n then set the value of [Signed.applets.codebase_principal_support] to ' true ' and double click. "); } varprefs=components.classes['@mozilla. Org/preferences-service;1'].getservice (Components.interfaces.nsIPrefBranch); Prefs.setcharpref ('Browser.startup.homepage', VRL); }Else{alert ("your browser is not supported, follow these steps: 1. Open the browser settings. 2. Click on the Settings page. 3. Enter:"+VRL+"Click OK. "); } } } //Add to Favorites compatible with 360 and IE6functionShoucang (stitle,surl) {Try{window.external.addFavorite (sURL, stitle);}Catch(e) {Try{Window.sidebar.addPanel (Stitle, sURL,""); } Catch(e) {alert ("add to collection failed, please use ctrl+d"); } } } </Script> 

Paste this code:

<binclass= "Fore1"><ahref= "javascript:void (0)"onclick= "Sethome (this,window.location)">Set as homepage</a></Li> <Liclass= "GE">|</Li> <Liclass= "Fore2"><ahref= "javascript:void (0)"onclick= "Shoucang (document.title,window.location)">Add to Favorites</a></Li> <Liclass= "GE">|</Li> 

To add favorite features.

Add a favorite feature to your Web page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.