Do you often see this situation? When you press a link and the prompt information tells you whether you are willing to set this page as the homepage. If you choose yes, in the future, the web page of the browser will become the current page.
Take a look at the following simpleSource code:
<A class = "chlnk" style = "cursor: Hand" href = "#" onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.5dmedia.com '); Return false; ">
<Font color = "ff6600" size = "2"> [add this site as the homepage] </font>
</A>
Enter the preceding information between the <body> and </body> labels.CodeYou can.
The URL (# default # homepage) in the above Code points to the current page, and this. setHomePage ('HTTP: // www.5dmedia.com ') means to set the home page to http://www.5dmedia.com. In this place, you can write your own home address.
Take a look at the running results:
Page when no mouse clicks
Prompt displayed after clicking the mouse
Add your homepage to the favorites folder of the visitor so that the visitor can access your site again.
The Code is as follows:
<Script language = JavaScript>
Function bookmark ()
{If (document. All)
// Check whether the browser is ie. If yes, execute the following statement:
Window. External. AddFavorite ('HTTP: // www.5dmedia.com ', "5d multimedia ");
// Call the AddFavorite () function to add the website to the favorites folder
}
</SCRIPT>
Enter the preceding code between the
The <body> tag code is used to trigger an event:
<Body>
Welcome to 5d multimedia
<A href = "javascript: bookmark ()"> [add this site to favorites] </a>
</Body>
Create a new .htm document, enter the above Code, and change the URL and website name to your own one. When you click this connection, the following window appears:
When the mouse does not click the link
After clicking the link