设置为首页的方法为:
<a href=# onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.djasp.net');event.returnValue=false;">设为首页</a>
其中的http://www.djasp.net为您要设为首页的网址。
如果您要设置当前网页的地址为首页,可以采用如下方法来实现:
<a href=# onClick="this.style.behavior='url(#default#homepage)';this.setHomePage(document.location.href);event.returnValue=false;">设为首页</a>
上述方法采用javascript的document.location对象的href属性来获得当前网页的全路径。
同理,如果您只想将当前网页所在的域名地址设为首页,您只需将document.location.href改为document.location.host即可。示例如下:
<a href=# onClick="this.style.behavior='url(#default#homepage)';this.setHomePage(document.location.host);event.returnValue=false;">设为首页</a>
说明:如果当前网页的地址为:http://www.djasp.net/standard/read.asp?id=27,则会将当前网页的域名地址(www.djasp.net)设为首页。
加入到收藏夹中的实现方法为:
<a href="Javascript:window.external.addFavorite('http://www.djasp.net','点击设计')">加入收藏</a>
举一反三,与上面设为首页的方法一样,如果您要将当前网页加入收藏,而当前网页的网址不确定,您可以采用以下方法:
<a href="Javascript:window.external.addFavorite(document.location.href,document.title)">加入收藏</a>
其中的document.title为自动获取当前网页的标题的javascript代码。

