Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help conflict!!!

Status
Not open for further replies.

opusuk

Programmer
Jul 14, 2008
2
GB
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 guess is maybe useless question? Read faq222-2244 to see how these forums work.

When you realise that this is a forum rather than a help desk, come back with a properly formed question and show what research you have done. It's also unreasonable to expect replies to long rambling questions in the 50 minutes that you waited before reposting.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Not using "txt" abbreviations on a professional forum would also be beneficial when reposting ("prob", "identic", "chk", "coz", etc...).

Many people see this as either a sign of student posting (which isn't allowed here), or cannot understand if English is a second language for them.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top