@import "design/stylesheet_main.css"; // Function returns a XML Request Object function getXMLReqObject() { var objReq = null; // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { objReq = new XMLHttpRequest(); } // branch for IE/Windows ActiveX version else if (window.ActiveXObject) { objReq = new ActiveXObject("Microsoft.XMLHTTP"); } return objReq; } var httpReq = null; var frmObj = document.join_form; function validateUsername() { var myDiv = document.getElementById("error"); //if(!chkText(document.join_form.join_username.value,'User Name field is empty. Please enter value')) // return false; var httpReq = getXMLReqObject(); if(document.join_form.join_username.value.length < '5'){ document.join_form.join_username.style.backgroundColor='red'; document.all.error.innerText = "Username Must be more than 4 Chars long"; document.join_form.join_submit.disabled = 'true'; } else if(document.join_form.join_username.value.length > '20'){ document.join_form.join_username.style.backgroundColor='red'; document.all.error.innerText = "Username must be less than 20 Chars Long"; document.join_form.join_submit.disabled = 'true'; } else{ //We dont wanna do requests for under 5 chars. if(httpReq) { var url = 'main/ajax.php?userName='+document.join_form.join_username.value+'&userOpt=0'; httpReq.open("GET", url, false); httpReq.send(null); if (httpReq.readyState == 4) { if (httpReq.status == 200) { if(httpReq.responseText == 'UserYes') { document.join_form.join_username.style.backgroundColor='red'; document.join_form.join_submit.disabled = 'true'; document.all.error.innerText = "Username Taken"; return false; } else if(httpReq.responseText == 'UserNo'){ document.join_form.join_username.style.backgroundColor='lime'; document.all.error.innerText = "Username Available"; document.join_form.join_submit.disabled = 0; } } else { alert("There was a problem retrieving data:\n" + httpReq.statusText); return; } } } } } function validate_email(){ if(document.join_form.join_email.value != document.join_form.join_email_confirm.value){ document.join_form.join_email.style.backgroundColor='red'; document.join_form.join_email_confirm.style.backgroundColor='red'; document.all.emailerror.innerText = "Emails Do not match"; document.all.email2error.innerText = "Emails Do not match"; document.join_form.join_submit.disabled = 1; } else{ document.join_form.join_email.style.backgroundColor='lime'; document.join_form.join_email_confirm.style.backgroundColor='lime'; document.all.emailerror.innerText = ""; document.all.email2error.innerText = ""; document.join_form.join_submit.disabled = 0; } } function validate_password(){ if(document.join_form.join_password.value != document.join_form.join_password_confirm.value){ document.join_form.join_password.style.backgroundColor='red'; document.join_form.join_password_confirm.style.backgroundColor='red'; document.all.passworderror.innerText = "passwords Do not match"; document.all.password2error.innerText = "passwords Do not match"; document.join_form.join_submit.disabled = 1; } else{ document.join_form.join_password.style.backgroundColor='lime'; document.join_form.join_password_confirm.style.backgroundColor='lime'; document.all.passworderror.innerText = ""; document.all.password2error.innerText = ""; document.join_form.join_submit.disabled = 0; } }
|
|
|
| |||||||||||||||||