以前实例是根据COOKIES的语言来alert相关提示:
var GloLangXML = "";//全局语言包
var alert1 = window.alert;//重写ALERT,用于COOKIE读取多语言,自动弹出对应语言的提示
window.alert = showAlert;
function showAlert(Str) {
if (getCookie("lang") == undefined || getCookie("lang") == "cn")
{ alert1(Str); return; }
else {
if (GloLangXML == "") {
$.ajax({
url: "../lanuage.xml",
type: "GET",
datatype: "xml",
async: false,
success: function (xml) {
GloLangXML = xml;
}
});
}
$(GloLangXML).find("tips").children("id").each(function () {
if ($(this).children("cn").text() == Str) {
alert1($(this).children("en").text());
return;
}
});
}
}