Jump to content

Why is the page below not working ?


jd2007

Recommended Posts

<html>
<head>
<script type="text/javascript">

var a=0;
var b=0;
var c=0;
var d=0;
var e=0;
var f=0;

function check1()
  {
     if (document.getElementById("text1").value == "")
     {
      a=0; 
      document.getElementById("alert1").style.visibility="visible";
     }
     else
     {
      a=1;
      document.getElementById("alert1").style.visibility="hidden";
     }
  }

function check2()
  {
   if (document.getElementById('text2').value == "")
     {
      document.getElementById("alert2").style.visibility="visible";
      b=0; 
     }
     else
     {
      document.getElementById("alert2").style.visibility="hidden";
      b=1;
     }
  }

function check3()
  {
    if (document.getElementById('text6').value == "")
     {
      document.getElementById("alert3").style.visibility="visible";
      c=0; 
     }
     else
     {
          
     }
  }

function check4()
  {
    if (document.getElementById('text4').value == "")
     {
      document.getElementById("alert4").style.visibility="visible";
      d=0;
     }
     else
     {
      document.getElementById("alert4").style.visibility="hidden";
      d=1;
     }
  }

function check5()
  {
     if (document.getElementById('text5').value == "")
     {
      document.getElementById("alert5").style.visibility="visible";
      e=0;  
     }
     else
     {
      document.getElementById("alert5").style.visibility="hidden";
      e=1;
     }
  }

function check6()
  {
     if (document.getElementById('text6').value == "")
     {
      document.getElementById("alert6").style.visibility="visible";
      f=0; 
     }
     else
     {
       if (document.getElementById('text6').value==document.getElementById('text5').value)
       {
       document.getElementById("alert6b").style.visibility="hidden";
       f=1; 
       }
       else
       {
       document.getElementById("alert6b").style.visibility="visible";
       f=-1;
       }   
     }
  }

var xmlHttp

function checkUsername(str)
{
if (str.length==0)
  { 
  document.getElementById("alert4").style.visibility="visible";
  
  return;
  }
else
  {
   document.getElementById("alert4").style.visibility="hidden";
  
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="username.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("alertuse").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function signup(stra, strb, strc, strd, stre)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
else
{
var url="signingup.php";
url=url+"?f="+stra+"?g="+strb+"?h="+strc+"?i="+strd+"?f="+stre;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 
}

function stateChanged2() 
{ 
if (xmlHttp.readyState==4)
{ 
  if (xmlHttp.responseText=="Success !")
  {
  document.getElementById("sf").style.visibility="hidden";
  document.getElementById("confirm").style.visibility="visible";
  } 
  else
  {
   alert(xmlHttp.responseText);
  } 
}
}
</script>
</head>
<body>
<script>

</script>
<div id=sf>
<label for=first id=first>First Name :</label> <input type="text" id="text1" onchange="check1();" />
<span id="alert1" style='visibility:hidden;'><< Please fill your first name in this field.</span><br><br>

<label for=last id=last>Last Name :</label> <input type="text" id="text2" onFocus="check1();" onChange="check2();" />
<span id="alert2" style='visibility:hidden'><< Please fill your last name in this field.</span><br><br>

<label for=email id=email>E-mail :</label> <input type="text" id="text3" onfocus="check1(), check2();" onchange="check3();" />
<span id="alert3" style='visibility:hidden'><< Please fill your email in this field.</span><span id="alert3b" style='visibility:hidden'><< Your email ain't valid. Please enter a valid e-mail.</span><br><br>

<label for=username id=username>Username :</label> <input type="text" id="text4" onfocus="check1(), check2(), check3();" />
<span id="alert4" style='visibility:hidden'><< Please fill your desired username in this field.</span>
<span id="alert4b" style='visibility:hidden'><< Username taken. Please choose another username.</span><br><br>

<label for=pass id=pass>Password :</label> <input type="password" id="text5" onfocus="check1(), check2(), check3(), checkUsername(document.getElementById('text4').value);" onchange="check5();" />
<span id="alert5" style='visibility:hidden'><< Please fill your desired password in this field.</span><br><br>

<label for=cpass id=cpass>Confirm Password :</label> <input type="password" id="text6" onfocus="check1(), check2(), check3(), check4(), check5();" /><span  id="alert6a" style='visibility:hidden'><< Please confirm your password.</span><span id="alert6b" style='visibility:hidden'><< Passwords don't match.</span><br><br>
<span id=alertuse></span><span id=www></span>
<input type="button" value="Sign Up" onClick="signup(document.getElementById('text1').value, document.getElementById('text2').value, document.getElementById('text3').value, document.getElementById('text4').value, document.getElementById('text6').value,);" />
</div>

<div id=confirm style='visibility:hidden;'>
Please enter the confirmation code in the box below.<br><br>
Confirmation Code: <input type="text" name="" />  <input type="button" value="Confirm" onclick=''/>
</div>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/63300-why-is-the-page-below-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.