with (document) if (getElementById && ((obj = getElementById(args[i])) != null)) { v = args[i + 2]; if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v; } obj.visibility = v; } } //隐藏显示层,加强版 function MM_showHideLayers_pro() { //v9.0 var i, p, v, obj, args = MM_showHideLayers_pro.arguments; for (i = 0; i < (args.length - 2) ; i += 3) with (document) if (getElementById && ((obj = getElementById(args[i])) != null)) { v = args[i + 2]; if (obj.style) { obj = obj.style; v = (v == 'show') ? 'block' : (v == 'hide') ? 'none' : v; } obj.display = v; } } //重新获取验证码 function ReGetVerifyCode(myIMG) { MM_findObj(myIMG).src = "/VerifyCodeImg.aspx?ID=" + MM_GetTime(); } //更换控件的css样式 function ChangeClassName(obj, classname) { obj.className = classname; } //ASCII字符长度 String.prototype.len = function () { return this.replace(/[^x00-xff]/g, "**").length; } //去掉字符串头部和尾部的空格 String.prototype.trim = function () { // 用正则表达式将前后空格 // 用空字符串替代。 return this.replace(/(^\s*)|(\s*$)/g, ""); } //截取字符串前面几个字符(按英文字节算、带省略号) String.prototype.sub = function (n) { var r = /[^\x00-\xff]/g; if (this.replace(r, "mm").length <= n) return this; // n = n - 3; var m = Math.floor(n / 2); for (var i = m; i < this.length; i++) { if (this.substr(0, i).replace(r, "mm").length >= n) { return this.substr(0, i) + "..."; } } return this; }; //获取时间 function MM_GetTime() { var d = new Date(); return d.getTime(); } //判断浏览器 var userAgent = navigator.userAgent, isIE = false; if (userAgent.indexOf('MSIE') != -1) { isIE = true; } if (!isIE) { //firefox innerText define HTMLElement.prototype.__defineGetter__("innerText", function () { var anyString = ""; var childS = this.childNodes; for (var i = 0; i < childS.length; i++) { if (childS[i].nodeType == 1) anyString += childS[i].tagName == "BR" ? '\n' : childS[i].innerText; else if (childS[i].nodeType == 3) anyString += childS[i].nodeValue; } return anyString; } ); HTMLElement.prototype.__defineSetter__("innerText", function (sText) { this.textContent = sText; } ); } //跳转地址 function GotoPage(url, objName) { obj = MM_findObj(objName); url = url.replace("page=", "page=" + obj.value) window.location.href = url; } //设置控件的HTML function SetControlHTML(obj, str) { MM_findObj(obj).innerHTML = str; } //获取xmlhttp对象 function GetXmlHttpRequest() { var oBao; if (window.XMLHttpRequest) { oBao = new XMLHttpRequest(); } else if (window.ActiveXObject) { oBao = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("您的浏览器不支持XMLHTTP无刷新技术!"); return; } return oBao; } //发送留言 function AddBook1(strSubject, strCompany, strEmail, strName, strTel, strMessage, strCode) { try { var url = window.location.pathname; $.ajax({ type: "POST", url: "js/AjaxData.ashx", data: "Action=AddBook1&Subject=" + encodeURIComponent(strSubject) + "&Company=" + encodeURIComponent(strCompany) + "&Email=" + encodeURIComponent(strEmail) + "&Name=" + encodeURIComponent(strName) + "&Url=" + encodeURIComponent(url) + "&Tel=" + encodeURIComponent(strTel) + "&Message=" + encodeURIComponent(strMessage) + "&Code=" + encodeURIComponent(strCode), success: function (ret) { alert(ret); ReGetVerifyCode('picCode'); } }); } catch (ex) { } }