Add code to favorites as the homepage

Source: Internet
Author: User
The method for setting as homepage is:
<A href = # onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('url'); event. returnvalue = false; "> set as homepage </a>
URL is the URL you want to set

To set the current webpage address as the homepage, you can:
<A href = # onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage (document. location. href); event. returnvalue = false; "> set as homepage </a>
The preceding method uses the href attribute of the document. Location object in JavaScript to obtain the full path of the current webpage.

Similarly, if you only want to set the domain name address of the current webpage as the homepage, you only need to change document. Location. href to document. Location. Host. Example:
<A href = # onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage (document. location. host); event. returnvalue = false; "> set as homepage </a>
Note: If the current webpage address is http://www.design007.com/design/index.htm, the domain name address (www.design007.com) of the browser page will be set as the homepage.

To add to favorites, follow these steps:
<A href = "javascript: window. External. AddFavorite ('HTTP: // www.design007.com ', 'Design 007')"> Add to favorites </a>

Similar to the above method, if you want to add the current web page to favorites, but the current web page is not sure, you can use the following method:
<A href = "javascript: window. External. AddFavorite (document. Location. href, document. Title)"> Add to favorites </a>
The document. title indicates the JavaScript code that automatically obtains the title of the current webpage.

Code used
Document. Location. host // obtain the webpage domain name address
Document. Location. href // obtain the complete webpage path
Document. Title // obtain the webpage title

<A target = _ top href = javascript: window. External. AddFavorite ('HTTP: // www.Ha321. Com ';, 'MTV music station')> Add to favorites </a>
<A href = # onclick = "This. style. Behavior = 'url (# default # homepage) '; this. setHomePage ('www.Ha321. Com '); "> set to homepage </a>
<P> & lt; A & nbsp; target = _ top & nbsp; href = javascript: window. external. addFavorite ('<a href = "http://www.mtv555.com & amp;/" target = _ blank> http: // www.Ha321. Com & amp; </a> #39;, '<a class = channel_keylink href = "http: // www.Ha321. Com/"> mtvmusic station </a> mtvmusic StationHa321. Com ') & gt; add to favorites & lt;/A & gt; </P>
<P> <br> & lt; A & nbsp; href = # & nbsp; onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('www.Ha321. Com '); "& gt; set to homepage & lt;/A & gt; </P>

Image Link
<A style = "cursor: Hand" onclick = "This. style. Behavior = 'url (# default # homepage )';
This. setHomePage ('HTTP ://Ha321. Com/bookmark-favorites.php '); ">

<U> set as home page </u> </a>

1. Text Type:
<A onclick = "This. style. Behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.Ha321. Com '); "href =" # "> set as the first region </a>
Example:
Set as the first region
2. Sort type:
<Input type = "button" value = "set as the first cursor" onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.Ha321. Com '); "href =" # ">
When you leave, the system automatically prompts you to set it to the homepage.
<Body onUnload = "basebody. style. Behavior = 'url (# default # homepage) '; If (! (Basebody. ishomepage ('HTTP ://Ha321. Com ') basebody. setHomePage ('HTTP: // www.Ha321. Com/'); ">
-------------------------------------------------------------
When the page is opened, a window pops up automatically asking if it is set to homepage string 7.
Place the following code between <Script language = "JavaScript">
Function myhomepage (){
This. Homepage. style. Behavior = 'url (# default # homepage) '; this. Homepage. setHomePage ('HTTP: // www.Ha321. Com ');
}
</SCRIPT>
<P align = "center"> <a href = "http:Ha321. Com "name =" Homepage"
Onclick = "myhomepage ();"> </a>

Add the following code to <body>:
Onload = "myhomepage ();"
That is: <body onload = "myhomepage ();">
------------------------------------------------------------------------------
Set the prompt to homepage when you point
Insert the following code into the <body> area:
<A href = "http://www.netbei.com/" onmouseover = "This. style. Behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.Ha321. Com '); "target =" _ blank "> set to homepage </a>
-------------------------------------------------------------------------------
Disable the current window function
Here, we can first enter the text "Close the window", drag it with the mouse to select it, type "/" in the "Link" input box, and cut into the source code window, in the link code, type the event-onclick = "javascript: window. close (); Return false ;".

String 2

The complete code is: <a href = "/" onclick = "javascript: window. Close (); Return false;"> close the window </a>

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.