zoukankan      html  css  js  c++  java
  • 兼容IE7的添加收藏,设为首页代码

     1代码1:兼容FF收藏
     2
     3<script type=”text/javascript”>
     4// <![CDATA[
     5function bookmark(){
     6var title=document.title
     7var url=document.location.href
     8if (window.sidebar) window.sidebar.addPanel(title, url,"");
     9else if( window.opera && window.print ){
    10var mbm = document.createElement('a');
    11mbm.setAttribute('rel','sidebar');
    12mbm.setAttribute('href',url);
    13mbm.setAttribute('title',title);
    14mbm.click();}

    15else if( document.all ) window.external.AddFavorite( url, title);
    16}

    17// ]]>
    18</script>
    19<a href=”javascript:bookmark()”>添加收藏</a>
    20
    21代码2:兼容FF/IE7收藏
    22
    23<script type=”text/javascript”>
    24<!
    25function fAddFavorite(sTitle, sURL){
    26if(document.all)
    27    window.external.AddFavorite(sURL, sTitle);
    28else
    29    window.sidebar.addPanel(sTitle, sURL, “”);
    30}

    31//–>
    32</script>
    33<a href=”#” onclick=”fAddFavorite(’在线代理’,'http://www.vstime.com’);”>添加收藏</a>
    34
    35代码3:兼容FF/IE设为首页
    36
    37<a href=”#” onClick=”this.style.behavior=’url(#default#homepage)’;this.setHomePage(’http://www.vstime.com/’);return(false);” style=”behavior: url(#default#homepage)”>设为首页</a>
    38
    39
    这里和大家分享和学习如何学IT!
  • 相关阅读:
    laravel 汇总数据
    Sway
    利用 Windows API Code Pack 修改音乐的 ID3 信息
    Windows Server 2012 R2 设置 NTP 服务
    Visual Studio "14" CTPs
    Win8.1 查看 “Windows 体验指数“
    json2csharp & json 格式化
    山寨版 WP8.1 Cortana 启动 PC
    Newtonsoft.Json WindowPhone7.1
    Cisco交换机基础命令 + Win Server08 R2 多网卡配置链路聚合
  • 原文地址:https://www.cnblogs.com/fuchifeng/p/1288303.html
Copyright © 2011-2022 走看看