hello i'am new here and i really need your help !!!
i have prob of conflict between 2 scripts
1- script use database to chk if email is not duplicated
2-script use database to chk if username is not taken
they are identic with different var name:
here is the first one:
-------------------------------------------------------
<script language="javascript" type="text/javascript">
/*This is the location of your PHP script*/
var url = "username.php?param=";
var image = '<img src="./images/indicator.gif"></a>';
//$("#imageDIV").html(image);
function updateName() {
/* Print the message to use while checking the database: */
document.getElementById('checked').innerHTML = image;
/* We're assuming your username input ID is "signup_username" */
var name = document.getElementById("signup_username").value;
http.open("GET", url + escape(name), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function handleHttpResponse() {
if (http.readyState == 4) {
results = http.responseText;
/* Again, we're assuming your username input ID is "signup_email" */
var name = document.getElementById("signup_username").value;
/* If the username is available, Print this message: */
if(results == "") results = "<font color=\"green\"><i>"+name+"</i> Is Available!</font>";
document.getElementById('checked').innerHTML = results;
}
}
function getHTTPObject() {
var xmlhttp;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
var http = getHTTPObject();
</script>
----------------------------------------------------
2-script is similare but with diferent var name
both call different php files
------------------------------------------------------
<script language="javascript" type="text/javascript">
/*This is the location of your PHP script*/
var url = "email.php?param=";
var image = '<img src="./images/indicator.gif"></a>';
//$("#imageDIV").html(image);
function updateName() {
/* Print the message to use while checking the database: */
document.getElementById('1checked').innerHTML = image;
/* We're assuming your username input ID is "username" */
var name = document.getElementById("signup_email").value;
http.open("GET", url + escape(name), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function handleHttpResponse() {
if (http.readyState == 4) {
results = http.responseText;
/* Again, we're assuming your username input ID is "signup_username" */
var name = document.getElementById("signup_email").value;
/* If the username is available, Print this message: */
if(results == "") results = "<font color=\"green\"><i>"+name+"</i> Is Available1!</font>";
document.getElementById('1checked').innerHTML = results;
}
}
function getHTTPObject() {
var xmlhttp;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
var http = getHTTPObject();
</script>
------------------------------------------------
both script executed coz conflict and only one work
really really need help!!!
thanks a lot!
i have prob of conflict between 2 scripts
1- script use database to chk if email is not duplicated
2-script use database to chk if username is not taken
they are identic with different var name:
here is the first one:
-------------------------------------------------------
<script language="javascript" type="text/javascript">
/*This is the location of your PHP script*/
var url = "username.php?param=";
var image = '<img src="./images/indicator.gif"></a>';
//$("#imageDIV").html(image);
function updateName() {
/* Print the message to use while checking the database: */
document.getElementById('checked').innerHTML = image;
/* We're assuming your username input ID is "signup_username" */
var name = document.getElementById("signup_username").value;
http.open("GET", url + escape(name), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function handleHttpResponse() {
if (http.readyState == 4) {
results = http.responseText;
/* Again, we're assuming your username input ID is "signup_email" */
var name = document.getElementById("signup_username").value;
/* If the username is available, Print this message: */
if(results == "") results = "<font color=\"green\"><i>"+name+"</i> Is Available!</font>";
document.getElementById('checked').innerHTML = results;
}
}
function getHTTPObject() {
var xmlhttp;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
var http = getHTTPObject();
</script>
----------------------------------------------------
2-script is similare but with diferent var name
both call different php files
------------------------------------------------------
<script language="javascript" type="text/javascript">
/*This is the location of your PHP script*/
var url = "email.php?param=";
var image = '<img src="./images/indicator.gif"></a>';
//$("#imageDIV").html(image);
function updateName() {
/* Print the message to use while checking the database: */
document.getElementById('1checked').innerHTML = image;
/* We're assuming your username input ID is "username" */
var name = document.getElementById("signup_email").value;
http.open("GET", url + escape(name), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function handleHttpResponse() {
if (http.readyState == 4) {
results = http.responseText;
/* Again, we're assuming your username input ID is "signup_username" */
var name = document.getElementById("signup_email").value;
/* If the username is available, Print this message: */
if(results == "") results = "<font color=\"green\"><i>"+name+"</i> Is Available1!</font>";
document.getElementById('1checked').innerHTML = results;
}
}
function getHTTPObject() {
var xmlhttp;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
var http = getHTTPObject();
</script>
------------------------------------------------
both script executed coz conflict and only one work
really really need help!!!
thanks a lot!