// To add the validate action to the form of index.jsp // NOTICE: the class name is hard coded, // so the the class of the mailTable must be set correctly var emailValidater = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/i; var mailBtn_buyer = lxy_getElementsByClassName("mailBtn_buyer"); mailBtn_buyer[0].onclick = function doSubForBuyer() { var thisForm = document.getElementById("pt7066"); if(thisForm.title.value.trim() == '') { alert("请填写您的Email地址"); thisForm.title.focus(); } else if(emailValidater.test(thisForm.title.value.trim()) == false) { alert("请您填写正确的Email地址"); thisForm.title.focus(); } else { thisForm.submit(); } } var mailBtn_seller = lxy_getElementsByClassName("mailBtn_seller"); mailBtn_seller[0].onclick = function doSubForSeller() { var thisForm = document.getElementById("pt8097"); if(thisForm.title.value.trim() == '') { alert("请填写您的Email地址"); thisForm.title.focus(); } else if(emailValidater.test(thisForm.title.value.trim()) == false) { alert("请您填写正确的Email地址"); thisForm.title.focus(); } else { thisForm.submit(); } }