zoukankan      html  css  js  c++  java
  • 网站全局js代码

    这几天开始看公司的一套系统,整理的网站全局js代码

    /*
    文件名:base.js
    功能说明:全站通用的全局变量及公用方法
    创建日期:2010-09-26
    */
    //引入jquery库文件
    document.write("<script type='text/javascript' src='/Lib/jquery-1.4.1.min.js'></script>");
    //全局配置
    var GlobalSetting = {
        //站点名称
        SiteName: "后台",
        //管理后台名称
        ManageName: "管理系统",
        //版权信息
        CopyRight: "Copyright @2010-2013 管理系统 All Rights Reserved."
    };
    //错误提示信息
    var ErrorInfo = {
        //ajax超时错误
        Ajax_TimeOut: "服务器忙,数据通信超时!"
    };
    //成功提示信息   
    var SuccessInfo = {
        RegisterSuccess: "注册成功!"
    };
    //如果页面没有标题,则使用全局设置中的标题
    if (document.title == "") {
        document.title = GlobalSetting.SiteName;
    }
    //如果页面有标题,则页面标题等于原标题+"-"+全局配置标题
    else {
        document.title = document.title + "-" + GlobalSetting.SiteName;
    }
    //设为首页
    function addFav() {
        if (document.all) {
            window.external.addFavorite("http://" + PathInfo, "46棋牌");
        } else if (window.sidebar) {
        window.sidebar.addPanel("46棋牌", "http://" + PathInfo, "");
        }
    }
    //添加收藏夹
    function setHome() {
        if (document.all) {
            document.body.style.behavior = "url(#default#homepage)";
            document.body.setHomePage("http://" + PathInfo);
        } else if (window.sidebar) {
            if (window.netscape) {
                try {
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                } catch (e) {
                    alert("抱歉,此操作被浏览器拒绝! 请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");
                }
            } else {
                var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
                prefs.setCharPref("browser.startup.homepage", "http://" + PathInfo);
            }
        }
    }

  • 相关阅读:
    Thymeleaf模板引擎绕过浏览器缓存加载静态资源js,css文件
    LCMapString/LCMapStringEx实现简体字、繁体字的转换。
    java8 LocalDateTime转unix时间戳(带毫秒,不带毫秒)
    关于全角半角
    c++builder 读写文件类
    Unresolved external 'AlphaBlend' referenced from
    GridhEH 选择勾CheckBox
    Variant
    TRegEx 正则表达式
    c++ 字符检测 TCharacter
  • 原文地址:https://www.cnblogs.com/wanshutao/p/4024309.html
Copyright © 2011-2022 走看看