设为首页,加入收藏

  • 如何实现"设为首页","加入收藏"的功能  
  • 解决思路:  

       将指定URL设为首页的功能主要是依靠IE默认行为homePage的setHomePage方法,而将指定URL加入收藏夹的实现则是external对象的AddFavorite方法。  

  • 具体步骤:  

        设为首页:  

[html]   view plain copy print ?
  1. <a href="http://localhost:8888/QianQiu/index"   
  2.    onClick="this.style.behavior='url(#default#homepage)';  
  3.             this.setHomePage('http://localhost:8888/QianQiu/index');  
  4.             return(false);"   
  5.    style="behavior: url(#default#homepage)">  
  6.     设为首页  
  7. </a>  

 

        加入收藏:  

[html]   view plain copy print ?
  1. <a href="http://localhost:8888/QianQiu/index"   
  2.    onclick="window.external.addFavorite('http://localhost:8888/QianQiu/index','千秋功罪');  
  3.             return false;"   
  4.    title="将本站添加到你的收藏夹中!"   
  5.    align="center">  
  6.     加入收藏  
  7. </a>  

你可能感兴趣的:(设为首页,加入收藏)