if (chkdiv('UserName')) { document.getElementById('UserName').value=''; } function del_space(s) { for(i=0;i=i;--j) { if(s.charAt(j)!=" ") break; } return s.substring(i,++j); } function out_check(){ var topic = document.getElementById("topic"); var chk=true; if (del_space(topic.value)==''){ chk=false alert("请输入留言标题!"); topic.focus(); return false; } var username = document.getElementById("username"); var chk=true; if (del_space(username.value)==''){ chk=false alert("请输入联系人!"); username.focus(); return false; } var email = document.getElementById("email"); var chk=true; if (del_space(email.value)==''){ chk=false alert("请输入联系email!"); email.focus(); return false; } var mon_edit = document.getElementById("mon_edit"); var chk=true; if (del_space(mon_edit.value)==''){ chk=false alert("请输入内容!"); mon_edit.focus(); return false; } var codestr=document.getElementById("codestr"); if (codestr.value==''){ chk=false; alert("请输入验证码!"); codestr.focus(); return false; } return chk; } function chk_post(){ var chk=true if (!out_check()){chk=false} if(chk){ document.getElementById('save_stat').innerHTML='数据提交中……请稍候……' document.getElementById('postbotton').disabled='disabled'; var topic=del_space(document.getElementById("topic").value); var username=del_space(document.getElementById("username").value); var email=del_space(document.getElementById("email").value); var tel=del_space(document.getElementById("tel").value); var phone=del_space(document.getElementById("phone").value); var mon_edit=del_space(document.getElementById("mon_edit").value); var codestr=document.getElementById("codestr").value; var mon_codename=document.messageform.mon_codename.value; var Ajax = new oAjax("savemessage.asp",show_returnsave); var arrKey = new Array("topic", "username", "email", "tel", "phone", "mon_edit", "codestr", "mon_codename"); var arrValue = new Array(topic, username, email, tel, phone, mon_edit, codestr, mon_codename); Ajax.Post(arrKey,arrValue); //reset_code(); } } function show_returnsave(arrobj){ if (arrobj){ var oDialog = new dialog("http://www.wuzhoutea.com.cn/"); oDialog.init(); //alert(arrobj[1]); oDialog.set('src',arrobj[1]); oDialog.event(arrobj[0],''); if (arrobj[1] != "2") { if (chkdiv('mon_codeimg')){ var mon_codeimg=document.getElementById("mon_codeimg"); if (arrobj[2]!="2") mon_codeimg.src=mon_codeimg.src+"&t="+Math.random(); } oDialog.button('dialogOk',"document.getElementById('postbotton').disabled='';document.getElementById('save_stat').innerHTML='';"); }else{ oDialog.button('dialogOk',"document.getElementById('postbotton').disabled='';document.location.reload();"); } } }