/****************************************************************************** * filename: index.js * Include Modul Scripting *******************************************************************************/ SKIN_PATH = "/Skins/default/"; function initCommonHeader() { $.get("/ajax.ashx?action=initcommonheader&t=" + Math.random(), function (rsp) { var IM = gav(rsp, "showIM"); showIM(IM); var username = gav(rsp, "username"); if (username.length > 0) { $j("commonHeaderGuest").hide(); $j("commonHeaderUsername").html(username); $j("commonHeaderUser").fadeIn(80); $j("login_user").show(); $j("user_default").hide(); return username; } }); return ""; } document.oncontextmenu = new Function("event.returnValue=false;"); document.onselectstart = new Function("event.returnValue=false;"); function resrt(str) { str = str.toLocaleString().replace("", ""); str = str.toLocaleString().replace("& ", "& "); str = str.toLocaleString().replace(" ' ", "' "); str = str.toLocaleString().replace("alert", "" "); str = str.toLocaleString().replace("script", "" "); str = str.toLocaleString().replace(" < ", "<"); str = str.toLocaleString().replace("> ", ">"); str = str.toLocaleString().replace("where", "$1here "); str = str.toLocaleString().replace("select", "$1elect "); str = str.toLocaleString().replace("insert", "$1nsert "); str = str.toLocaleString().replace("create", "$1reate "); str = str.toLocaleString().replace("drop", "$1rop "); str = str.toLocaleString().replace("alter", "$1lter "); str = str.toLocaleString().replace("delete", "$1elete "); str = str.toLocaleString().replace("update", "$1pdate "); str = str.toLocaleString().replace("and", "$1hend "); str = str.toLocaleString().replace("", "$1hend "); str = str.toLocaleString().replace("", "$1hend "); str = str.toLocaleString().replace(" ", "$1hend "); } function xuanze() { var xz = document.getElementById('seachkeywords').value; if (xz.length == 0) { xz = ""; } window.location.href="/Tfbsdi/Joefy.btqy?pckuzqf=qspevdu&lxe=" + xz; } /******************** * 根据key获取 ajax对象节点值getAjaxVal * xMsg : xml对象 * key : 节点的属性key ********************/ function gav(xMsg, key) { var jMsg = $(xMsg); var s = $(jMsg.find("node[key=" + key + "]")).text(); return s; } //是否显示在线客服 function showIM(res) { if ($("#bodd").html() != "") { if (res == "True") { $("#bodd").show(); $("#kefubtn").hide(); $("#divOranIm").show(); } else { $("#bodd").hide(); $("#kefubtn").show(); $("#divOranIm").hide(); } } } //初始化头部热门关键词 function initCommonHeaderKeywords(_s) { if (_s == "") _s = "6"; $.post("/ajax.ashx?action=initcommonheaderkeywords&t=" + Math.random(), { s: _s }, function (msg) { $j("commonHeaderkeywords").html(msg); }); } function $j(elmId) { return $("#" + elmId); } function $v(elmId, val) { if (val == null) { var o = $j(elmId).attr("value"); if (o == null || o == undefined) return ""; return o; } else { return $j(elmId).attr("value", val); } } function $tv(elmId) { return $.trim($v(elmId)); } //邮件订阅 function subscription(src, elmId) { if (elmId == null) { elmId = "txtSubscriptionEmail"; } var _email = $.trim($j(elmId).val()); var ptn = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; if (_email.length == 0) { $a("E-Mail 不可为空"); $j(elmId).focus(); return false; } if (!ptn.test(_email)) { $a("E-Mail 格式错误。"); $j(elmId).focus(); return false; } showProc(src); $.post("/ajax.ashx?action=subscription&t=" + Math.random(), { email: _email }, function (msg) { var sta = gav(msg, "state"); var sMsg = gav(msg, "msg"); if (sta == "1") { $a(sMsg, 1); } else { $a(sMsg); } showProc(src, false); }); } function showProc(src, show) { var oImg = $j("imgProc"); if (show == null) show = true; if (show) { $(src).hide(); if (oImg.length > 0) { oImg.remove(); } $("正在处理").insertAfter(src); } else { $(src).show(); oImg.remove(); } } function hideDdl(cntrId) { var arrTags = ["select", "iframe", "applet", "object"]; var jCntr; if (cntrId != null) { jCntr = $j(cntrId); } else { jCntr = $(document.body); } for (var i = 0; i < arrTags.length; ++i) { jCntr.find(arrTags[i]).css("visibility", "hidden"); } } function $a(sMsg, boxType, autoClose, focusElmId, sTitle, behavior) { if (boxType == null) { boxType = 2; } if (autoClose == null) { autoClose = -1; } //标题 if (sTitle == null) { sTitle = "消息提示"; } hideDdl(); var jMesbook1 = $j("mesbook1"); if (jMesbook1.length == 0) { var sHtml = "
" + "
关闭
" + "
" + "
" + "
" + "" + "
" + "" + "
" + "
" + "
"; $(document.body).append(sHtml); } var jMesbook1 = $j("mesbook1"); var jMesbook1ImgClose = $j("mesbook1ImgClose"); var jMesbook1Icon = $j("mesbook1Icon"); var jMesbook1Msg = $j("mesbook1Msg"); var jMesbook1AutoClose = $j("mesbook1AutoClose"); var jMesbook1Delay = $j("mesbook1Delay"); var jMesbook1Title = $j("mesbook1Title"); var jMesbook1Btns = $j("mesbook1Btns"); jMesbook1Title.html(sTitle); //消息内容 jMesbook1Msg.html(sMsg); //图标 var iconPath = SKIN_PATH + "Img/"; switch (boxType) { case 1: iconPath += "ico_ok.gif"; break; case 2: iconPath += "ico_info.gif"; break; case 3: iconPath += "ioc_ques.gif"; break; case -1: iconPath += "ico_error.gif"; break; default: iconPath += "ico_normal.gif"; break; } jMesbook1Icon.attr("src", iconPath); //关闭按钮 var okBtn = jMesbook1Btns.find("input"); okBtn.removeAttr("onclick"); okBtn.click(function () { hideMsg(); if (focusElmId != null) { $j(focusElmId).focus(); } if (behavior != null) { behavior(); } }); jMesbook1ImgClose.removeAttr("onclick"); jMesbook1ImgClose.click(function () { hideMsg(); if (focusElmId != null) { $j(focusElmId).focus(); } if (behavior != null) { behavior(); } }); okBtn.focus(); //显示 showFullBg(); setCM("mesbook1"); //relocation("mesbook1"); jMesbook1.fadeIn(80); } /******************** * 显示一个全屏灰度背景 * elmId : 元素ID或元素 ********************/ function showFullBg(elmId, isHideDdl, opacity, bgColor, zIndex, speed, behavior) { if (elmId == null) { elmId = "oran_full_bg"; } var jElm = $j(elmId); if (jElm.length == 0) { var sHtml = ""; $(document.body).append(sHtml); } if (opacity == null) { opacity = 0.75; } if (bgColor == null) { bgColor = "#777"; } if (zIndex == null) { zIndex = "9"; } if (speed == null) { speed = 80; } if (isHideDdl == null) { isHideDdl = true; } var jElm = $j(elmId); var dd = document.documentElement; var sWidth = dd.scrollWidth; var sHeight = dd.scrollHeight; var cH = dd.clientHeight; var cW = dd.clientWidth; if (sHeight < cH) { sHeight = cH; } if (sWidth < cW) { sWidth = cW; } jElm.css({ "z-index": zIndex, "background": bgColor, "opacity": opacity, "filter": "progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacity * 100 + ")" }); jElm.css({ "height": sHeight, "width": sWidth }); if (isHideDdl) { hideDdl(null, behavior); } jElm.fadeIn(speed); if (behavior != null) { behavior(); } } function setCM(elmId, speed) { var jElm; if (typeof (elmId).toString().toLowerCase() == "string") { jElm = $j(elmId); } else { jElm = $(elmId); } if (speed == null) { speed = 80; } var h = jElm.height() / 2; var w = jElm.width() / 2; var $w = $(window); var top = $w.height() / 2 + $w.scrollTop(); //jElm.css({ "top": top+"px", "margin-top" : "0px !important", "left": "50%", "margin-left": "-" + w + "px" }); jElm.css({ top: top + "px", marginTop: "0px", left: "50%", marginLeft: (-w) + "px" }); var isIE = navigator.userAgent.toUpperCase().indexOf("MSIE") == -1 ? false : true; $w.scroll(function () { var top = $w.height() / 2 + $w.scrollTop(); jElm.css({ 'top': top + 'px' }); }); //if(isIE){ jElm.css({ "position": "absolute", "z-index": "999" }); // }else{ // jElm.css({ "position": "fixed", "z-index": "999"}); // } jElm.fadeIn(speed); } function setCMS(elmId, speed) { var jElm; if (typeof (elmId).toString().toLowerCase() == "string") { jElm = $j(elmId); } else { jElm = $(elmId); } if (speed == null) { speed = 80; } var h = jElm.height() / 2; var w = jElm.width() / 2; var height = document.documentElement.scrollTop; if (height > 100) { jElm.css({ "top": "50%", "margin-top": "-" + h + "px", "left": "50%", "margin-left": "-" + w + "px" }); } else { h = 200; jElm.css({ "margin-top": "-" + h + "px", "left": "50%", "margin-left": "-" + w + "px" }); } jElm.css({ "position": "absolute", "z-index": "999" }); jElm.fadeIn(speed); } /******************** * 重置一个层为绝对居中于窗口的位置 * elmId : 元素ID或元素 ********************/ function relocation(elmId) { var jElm; if (typeof (elmId).toString().toLowerCase() == "string") { jElm = $j(elmId); } else { jElm = $(elmId); } if (jElm.length == 0) { return; } var dd = document.documentElement; var t = (dd.scrollTop - (jElm.height() / 2) + "px"); jElm.css({ "margin-top": t/*, "left": l */ }); } /******************** * 隐藏消息提示层 ********************/ function hideMsg() { showDdl(); var jShadow = $j("mesbook1"); hideFullBg(); jShadow.fadeOut(80); } /******************** * 隐藏下拉框函数 ********************/ function showDdl() { var arrTags = ["select", "iframe", "applet", "object"]; for (var i = 0; i < arrTags.length; ++i) { $(arrTags[i]).css("visibility", "visible"); } } /******************** * 隐藏全屏灰度背景 * speed : (可选)渐变消退的速度 ********************/ function hideFullBg(elmId, speed) { if (elmId == null) { elmId = "oran_full_bg"; } if (speed == null) { speed = 80; } var jElm = $j(elmId); jElm.fadeOut(speed); showDdl(); } //用户登陆 function LoginCheck(_username, _password) { if (_username == undefined || _username.length == 0) { $a("请输入用户名", "错误提示", "txtUsername"); return; } if (_password == undefined || _password.length == 0) { $a("请输入密码", "错误提示", "txtPassword"); return; } $.post("/ajax.ashx?action=logincheck&t=" + Math.random(), { username: _username, password: _password }, function (msg) { if (gav(msg, "state") == "1") { $a(gav(msg, "msg"), null, null, null, null, function () { window.location.href="mpdbujpo.isfg" + "?t=" + Math.random(); }); //window.location.href="vsm;" } else { $a(gav(msg, "msg")); }; }); } function SearchObjectByGet(FieldList, url, getUrlOnly) { if (getUrlOnly == null) { getUrlOnly = false; } var newUrl = GetSearchURL(FieldList, url); if (getUrlOnly) { return newUrl; } window.location.href="ofxVsm;" } //根据字段列表获取查询页面路径字符串 //FieldList格式:控件ID名称,查询字段名称|控件ID名称1,查询字段名称1|.. function GetSearchURL(FieldList, URL) { //1\定义变量 if (URL == null) { URL = getIntactRawUrl(); } //2\循环把变量列表取出来,组合成URL var TempFieldList = FieldList.split("|"); for (var i = 0; i < TempFieldList.length; i++) { //1>寻找控件 var control1 = TempFieldList[i].split(","); var controlname; var control = document.getElementById(control1[0]); if (control1.length == 2) { controlname = control1[1]; } else { controlname = control1[0]; } if (control != null) { //2>取出控件的值 var controlvalue = control.value; //3>设置URL if (controlvalue != null) { URL += "&" + controlname + "=" + encodeURIComponent(controlvalue); } } } return URL; } function getIntactRawUrl() { var path = location.href; var pos; pos = path.lastIndexOf('#'); path = path.substring(0, pos); return path; } /******************** * 增加书签 * url : URL * title : 收藏项目的标题 ********************/ function addBookmark(url, title) { if (window.sidebar) { window.sidebar.addPanel(title, url, ""); } else if (document.all) { window.external.AddFavorite(url, title); } else if (window.opera && window.print) { return true; } } //加入收藏 function addBookmark() { var title = document.title; var url = document.URL; try { window.external.addFavorite(url, title); } catch (e) { try { window.sidebar.addPanel(title, url, ""); } catch (e) { alert("抱歉,您所使用的浏览器无法完成此操作。\n\n加入收藏失败,请使用Ctrl+D进行添加"); } } } //在线预约 function subLeaveword(src) { var name = $v('txtName'); var phone = $v('txtmobile'); var shortdesc = $v('txtshortdesc'); var errorMsg = ""; var reg = /^\s*$/; if (reg.test(name) || name == "姓名") { errorMsg += "

联系人不可为空

"; } if (reg.test(phone) || phone == "电话") { errorMsg += "

手机不可为空

"; } if (reg.test(shortdesc) || shortdesc == "备注") { errorMsg += "

您的需求不能为空

"; } var partten = /^1\d{10}$/; if (!partten.test(phone)) { errorMsg += "

请输入正确的手机号码

"; } var ptn = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; // if (reg.test(shortdesc) || shortdesc == "请输入留言内容") { // errorMsg += "

留言内容不能为空

"; // } // if (reg.test(txtVerCode)) { // errorMsg += "

验证码不可为空

"; // } if (errorMsg.length > 0) { $a(errorMsg); return; } showProc(src); $.post("/ajax.ashx?action=subLeavewords&t=" + Math.random(), { name: name, phone: phone, desc: shortdesc }, function (msg) { var sta = gav(msg, "state"); var sMsg = gav(msg, "msg"); if (sta == "1") { $a(sMsg, 1); $("#txtName").val("您的真实姓名"); $("#txtmobile").val("您的手机号码"); $("#txtshortdesc").val("留 言"); } else { $a(sMsg); } showProc(src, false); }); }