JavaScript通用的加入收藏夹代码

  1. <script type="text/javascript">
  2. // <![CDATA[
  3. function bookmark(){
  4. var title=document.title
  5. var url=document.location.href
  6. if (window.sidebar) window.sidebar.addPanel(title, url,"");
  7. else if( window.opera && window.print ){
  8. var mbm = document.createElement('a');
  9. mbm.setAttribute('rel','sidebar');
  10. mbm.setAttribute('href',url);
  11. mbm.setAttribute('title',title);
  12. mbm.click();}
  13. else if( document.all ) window.external.AddFavorite( url, title);
  14. }
  15. // ]]>
  16. </script>
  17. <a href="javascript:bookmark()">加入收藏夹</a>

你可能感兴趣的:(JavaScript,Opera)