zoukankan      html  css  js  c++  java
  • js_加入收藏夹功能

    <script type="text/javascript">
    function addToFavorite(obj) {
        var url = "http://www.weiduduan.com/";
        var title = "淄博安泽特气有限公司";
        var ua = navigator.userAgent.toLowerCase();
        if (ua.indexOf("360se") > -1) {
            alert("由于360浏览器功能限制,请按 Ctrl+D 手动收藏!");
        }
        else if (ua.indexOf("msie 8") > -1) {
            window.external.AddToFavoritesBar(url, title); //IE8
        }
        else if (document.all) {
            try {
                window.external.addFavorite(url, title);
            } catch (e) {
                alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!');
            }
        }
        else if (window.sidebar) {
            obj.href = url;
            window.sidebar.addPanel(title, url, "");
        }
        else {
            alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!');
        }
    }
    </script>

      <a class="shucang" rel="sidebar" href="javascript:void(0)" title="淄博安泽特气有限公司" onclick="javascript:addToFavorite(this)" style="color: #000; font-size: 16px;">收藏本站</a>

  • 相关阅读:
    Unity Glossary
    Event-Driven Programming: Introduction, Tutorial, History (Stephen Ferg 著)
    2019年11月
    2019年10月
    2019年9月
    LuaFramework 学习
    xLua 学习
    2019年8月
    【原】AFNetworking源码阅读(二)
    【原】AFNetworking源码阅读(一)
  • 原文地址:https://www.cnblogs.com/zhouyx/p/4223079.html
Copyright © 2011-2022 走看看