//AJAX Start var Try = { these: function() { var returnValue; for (var i = 0; i < arguments.length; i++) { var lambda = arguments[i]; try { returnValue = lambda(); break; } catch (e) {} } return returnValue; } } var getTransport = function() { return Try.these( function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP')}, function() {return new XMLHttpRequest()} ) || false; } function JAX(url, parameters) { var req = getTransport(); if (parameters) { req.open('POST', url, false); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.send(parameters); } else { req.open('GET', url, false); req.send(null); } if (req.status == 200) { return req.responseText; } else { return req.status; } } /*检测字符串所占的字节数*/ function mbStringLength(s) { var totalLength = 0; var i; var charCode; for (i = 0; i < s.length; i++) { charCode = s.charCodeAt(i); if (charCode < 0x007f) { totalLength = totalLength + 1; }else if ((0x0080 <= charCode) && (charCode <= 0xffff)) { totalLength += 2; } } return totalLength; } function submitMsgForm(){ var leavetype = 0; leavetyperadio=document.getElementsByName("leavetype"); for (var i=0;i30) { alert("请正确填写您的姓名"); document.getElementById("CName").focus(); } else if(tel=="") { alert("请填写您的联系电话"); document.getElementById("Phone").focus(); } else if(mbStringLength(tel)>150) { alert("请正确填写您的电话"); document.getElementById("Phone").focus(); } else if(company=="") { alert("请填写您的单位/公司"); document.getElementById("GuestType").focus(); }else if(mbStringLength(company)>150) { alert("您的单位/公司名称不能超过75个汉字或者150个字符"); document.getElementById("GuestType").focus(); }else if(ly=="") { alert("请填写您的留言内容"); document.getElementById("Content").focus(); }else if(mbStringLength(ly)>3000) { alert("您的留言内容不能超过1500个汉字或者3000个字符"); document.getElementById("Content").focus(); }else if (email!="" && mbStringLength(email)>150) { alert("请正确填写您的邮箱"); document.getElementById("Email").focus(); } else { //ajax url = "./addLeaveword_ajax.php"; surl="v"+document.location; if (surl.indexOf("/show/")>0) url = "/dons/addLeaveword_ajax.php"; if (surl.indexOf("/ns")>0) url = "/dons/addLeaveword_ajax.php"; var paradata = [ "CName=", name, "&leavetype=", leavetype, "&Phone=", tel, "&GuestType=", company, "&Email=",email, "&Content=",ly, "&FromPID=",FromPID, "&CID=",CID ].join(""); /* document.getElementById("leavetypeA").value= leavetype; document.getElementById("CNameA").value = name; document.getElementById("PhoneA").value = tel; document.getElementById("GuestTypeA").value= company; document.getElementById("EmailA").value= email; */ var response = JAX(url,paradata); if('ok' == response) { alert("留言提交成功。"); popwin=document.getElementById("popwin_bg_tran"); if (popwin==null){ }else{ close_popwin(); } winlw=document.getElementById("LW"); if (winlw==null){} else{ winlw.style.display="none"; } //document.getElementById("errMessage").innerHTML = response; //document.getElementById("guestBook").style.display="none"; //document.getElementById("guestBookAllBig").style.display=""; } else alert(response); } } function submitMsgFormP(Pstr){ var leavetype = 0; leavetyperadio=document.getElementsByName(Pstr+"leavetype"); for (var i=0;i30) { alert("请正确填写您的姓名"); document.getElementById(Pstr+"CName").focus(); } else if(tel=="") { alert("请填写您的联系电话"); document.getElementById(Pstr+"Phone").focus(); } else if(mbStringLength(tel)>150) { alert("请正确填写您的电话"); document.getElementById(Pstr+"Phone").focus(); } else if(company=="") { alert("请填写您的单位/公司"); document.getElementById(Pstr+"GuestType").focus(); }else if(mbStringLength(company)>150) { alert("您的单位/公司名称不能超过75个汉字或者150个字符"); document.getElementById(Pstr+"GuestType").focus(); }else if(ly=="") { alert("请填写您的留言内容"); document.getElementById(Pstr+"Content").focus(); }else if(mbStringLength(ly)>3000) { alert("您的留言内容不能超过1500个汉字或者3000个字符"); document.getElementById(Pstr+"Content").focus(); }else if (email!="" && mbStringLength(email)>150) { alert("请正确填写您的邮箱"); document.getElementById(Pstr+"Email").focus(); } else { //ajax url = "./addLeaveword_ajax.php"; surl="v"+document.location; if (surl.indexOf("/show/")>0) url = "/dons/addLeaveword_ajax.php"; if (surl.indexOf("/ns")>0) url = "/dons/addLeaveword_ajax.php"; var paradata = [ "CName=", name, "&leavetype=", leavetype, "&Phone=", tel, "&GuestType=", company, "&Email=",email, "&Content=",ly, "&FromPID=",FromPID, "&CID=",CID ].join(""); var response = JAX(url,paradata); if('ok' == response) { alert("留言提交成功。"); popwin=document.getElementById("popwin_bg_tran"); if (popwin==null){ }else{ close_popwin(); } winlw=document.getElementById("LW"); if (winlw==null){} else{ winlw.style.display="none"; } //------------------------------- if ($("#popwin").attr('showPhoneId')!=""){ Id=$("#popwin").attr('showPhoneId'); MsgType=$("#popwin").attr('MsgType'); ImShowId=$("#popwin").attr('ImShowId'); $("#LshowPhone" + Id+"_"+MsgType).hide(); $("#LPhone" + Id+"_"+MsgType).show(); $("#showPhone" + Id+"_"+MsgType).hide(); $("#Phone" + Id+"_"+MsgType).show(); $(".lyokshowPhone").show(); $(".lyokhidePhone").css('display', 'none'); var url = "/dons/insertofficebrowsehistory.php?Show="+Id+"&ImShowID=" + ImShowId+"&MsgType=" + MsgType; $.ajax({ url: url, dataType: 'json', cache: false, success: function (json) { } }); } //------------------------------- //document.getElementById("errMessage").innerHTML = response; //document.getElementById("guestBook").style.display="none"; //document.getElementById("guestBookAllBig").style.display=""; } else alert(response); } } function submitguestBookAll() { var ALL_ID = ''; var flag=0; for(i=0;i<3;i++) { if(document.lw_all.guestBookN[i].checked) { flag=1; ALL_ID = ALL_ID + document.lw_all.guestBookN[i].value + '|'; } } document.getElementById('All_ID').value = ALL_ID; if (!flag) { alert("请选择要批量留言的产品!") document.lw_all.guestBookN[0].focus(); return false; } else { url = "./guestbookAll.php"; surl="v"+document.location; if (surl.indexOf("/show/")>0) url = "/dons/guestbookAll.php"; if (surl.indexOf("/ns")>0) url = "/dons/guestbookAll.php"; document.lw_all.action=url; document.lw_all.target="guestFrm"; document.lw_all.submit(); } } function lw_close() { document.getElementById("LW").style.display="none"; } function scrollImg() { var posX,posY; if (window.innerHeight) { posY = window.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { posY = document.documentElement.scrollTop; } else if (document.body) { posY = document.body.scrollTop; } posHeight= document.documentElement.clientHeight ; var LW=document.getElementById("LW"); if (document.getElementById("LW_Content").style.display=="none") { LW.style.top=(posY+posHeight-40)+"px"; } else { LW.style.top=(posY+posHeight-270)+"px"; } } function load_scrollImg() { window.setInterval("scrollImg()",10); } function submitMsgFormByID(formid){ var leavetype = 0; if(document.getElementById(formid)) leavetyperadio=document.getElementById(formid).leavetype; else leavetyperadio=document.getElementsByName("leavetype"); for (var i=0;i30) { alert("请正确填写您的姓名"); if(document.getElementById(formid)) document.getElementById(formid).CName.focus(); else document.getElementById("CName").focus(); } else if(tel=="") { alert("请填写您的联系电话"); if(document.getElementById(formid)) document.getElementById(formid).Phone.focus(); else document.getElementById("Phone").focus(); } else if(mbStringLength(tel)>150) { alert("请正确填写您的电话"); if(document.getElementById(formid)) document.getElementById(formid).Phone.focus(); else document.getElementById("Phone").focus(); } else if(company=="") { alert("请填写您的单位/公司"); if(document.getElementById(formid)) document.getElementById(formid).GuestType.focus(); else document.getElementById("GuestType").focus(); }else if(mbStringLength(company)>150) { alert("您的单位/公司名称不能超过75个汉字或者150个字符"); if(document.getElementById(formid)) document.getElementById(formid).GuestType.focus(); else document.getElementById("GuestType").focus(); }else if(ly=="") { alert("请填写您的留言内容"); if(document.getElementById(formid)) document.getElementById(formid).Content.focus(); else document.getElementById("Content").focus(); }else if(mbStringLength(ly)>3000) { alert("您的留言内容不能超过1500个汉字或者3000个字符"); if(document.getElementById(formid)) document.getElementById(formid).Content.focus(); else document.getElementById("Content").focus(); }else if (email!="" && mbStringLength(email)>150) { alert("请正确填写您的邮箱"); if(document.getElementById(formid)) document.getElementById(formid).Email.focus(); else document.getElementById("Email").focus(); } else { //$("#diverrormsg").html("正在提交,请稍候....."); $.ajax({ type : "POST", url : "/img/pub/addLeaveword_ajax.php", dataType: 'html', cache: false, clearForm:false, restForm:false, contentType : "application/x-www-form-urlencoded; charset=utf-8", data: $("#"+formid).serialize(), success : function(result) { if (result=="ok") if($("#"+formid).attr("resultokclosewin")=="1"){ // 2023.06.19 alert("留言提交成功。"); close_popwin(); }else{ showliuyanok(); } else alert(result); } }); } } function showliuyanok(){ popwin=document.getElementById("popwin_bg_tran"); if ((popwin==null) && (document.getElementById("telpopwin_tran")==null)){ }else{ alert("留言提交成功。"); close_popwin(); } $("#divshowok").css('display', 'block'); $("#divliuyan").css('height', $("#divshowok").height()-4); repostion(); } function repostion(){ scTop=$(window).scrollTop(); cWidth=$(window).outerWidth(); cHeight=$(window).outerHeight(); $("#divliuyan").css('top', cHeight+scTop-$("#divliuyan").height()-12); $("#divliuyan").css('left', cWidth-$("#divliuyan").width()-8); }