網站全域js代碼

來源:互聯網
上載者:User

標籤:style   http   io   使用   ar   java   檔案   sp   資料   

這幾天開始看公司的一套系統,整理的網站全域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("抱歉,此操作被瀏覽器拒絕!\n\n請在瀏覽器地址欄輸入“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);
        }
    }
}

網站全域js代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.