Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Intermediate
Apr 17, 2000

Set Home Page with DHTML

DHTML intrinsic behavior gives advantage to changing the user's home page to the current page.

The style block, which goes in the <HEAD> of the document, associates the home page class with the built-in behavior. The inline STYLE on the <SPAN> tag simulates the look and feel of a hot link, but clicking the link doesn't cause a new page to be loaded (IE5 also provides a new feature, to use conditional comments to hide this link from lower browsers).

The style block goes in the page <HEAD>:

 
<STYLE>
<!--
.homepage {behavior:url(#_IE_)}
-->
</STYLE> 
This code can be placed anywhere in the page body: 
<!--#if IE 5#>
<U><SPAN STYLE='color:blue;cursor:hand;'
CLASS=homepage
ONCLICK='this.setHomePage(window.location);'>
Make this your home page</SPAN></U>
<!#endif#--> 
We can also change the user's home page to a page other than the current page by replacing window.location in the above example with a specific URL. For example,
 
ONCLICK="this.setHomePage('http://www.myhome.com')"
Internet Explorer first asks the user if they want to change their home page rather than setting it automatically.
Maheshwar D.
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap