function $(id){ return document.getElementById(id); } function postEnterFee(){ var myForm = document.getElementById("form1"); myForm.submit() ; } function saveAction(){ var isPass = validUserInput(); if(isPass){ $("h_post").value = "1"; postEnterFee(); } } function validUserInput(){ var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; var email_1 = $("txt_email1").value; if(email_1.trim() != ""){ chkFlag = pattern.test(email_1); if(!chkFlag){ alert("Email1 格式错误,请修改"); return false; } } var email_2 = $("txt_email2").value; if(email_2.trim() != ""){ chkFlag = pattern.test(email_2); if(!chkFlag){ alert("Email2 格式错误,请修改"); return false; } } var strP =/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/; var officeNum = $("txt_officenum").value; if(officeNum.trim() != ""){ chkFlag = strP.test(officeNum); if(!chkFlag){ alert("办公电话 格式错误,请修改"); return false; } } var faxNum = $("txt_fax").value; if(faxNum.trim() != ""){ chkFlag = strP.test(faxNum); //请输入正确的电话号码:电话号码格式为国家代码(2到3位)-区号(2到3位)-电话号码(7到8位)-分机号(3位) if(!chkFlag){ alert("传真号码 格式错误,请修改"); return false; } } var qqVal = $("txt_qq").value; gbcode = /^[\u4e00-\u9fa5]+$/i; if(qqVal.trim() != ""){ chkFlag = gbcode.test(qqVal); if(chkFlag){ alert("QQ信息 格式错误,请修改-不支持中文"); return false; } } var msnVal = $("txt_msn").value; if(msnVal.trim() != ""){ chkFlag = gbcode.test(msnVal); if(chkFlag){ alert("MSN信息 格式错误,请修改-不支持中文"); return false; } } var mobileNum = $("txt_mobile").value; mobileP = /^[1][0-9][0-9]{9}$/; if(mobileNum.trim() != ""){ chkFlag = mobileP.test(mobileNum); if(!chkFlag){ alert("移动电话 格式错误,请修改-不支持中文"); return false; } } return true; } String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); } function refresh(){ var baseInfo = null; var url = "AccountService.aspx?handle=getbaseinfo&uid="+newGuid(); var loader = dhtmlxAjax.getSync(url); var baseInfoVal = loader.xmlDoc.responseText;//alert(opInfo); var baseInfo = eval('(' + baseInfoVal + ')'); alert(baseInfoVal); if(baseInfo.base.length > 0){ $("txt_englishname").value = baseInfo.base[0].uname; $("txt_officenum").value = baseInfo.base[0].office; $("txt_fax").value = baseInfo.base[0].fax; $("txt_email1").value = baseInfo.base[0].em1; $("txt_email2").value = baseInfo.base[0].em2; $("txt_qq").value = baseInfo.base[0].qq; $("txt_msn").value = baseInfo.base[0].msn; $("txt_mobile").value = baseInfo.base[0].mobile; } } //获取GUID function newGuid() { var guid = ""; for (var i = 1; i <= 32; i++){ var n = Math.floor(Math.random()*16.0).toString(16); guid += n; if((i==8)||(i==12)||(i==16)||(i==20)) guid += "-"; } return guid.toUpperCase(); }