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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make a real string comparison ?

Status
Not open for further replies.

tyris

Programmer
Nov 2, 2000
311
FR
hi all,

i have this code :

function launch(){
alert(CanAdd);
alert(next_page);
if (CanAdd != "false" ) {
if (next_page != ""){
parent.window.location=next_page;
} else {
alert("No contact type selected");
}
} else {
if (next_page != "organizer.ASP?WCI=oAddLBTLocal&") {
parent.window.location=next_page;
} else {
alert("You don't have access to the ADD a Local Contact function");
}
}
}

the problem is not in the reason why i make those tests and those things. i could have replaced them by :

if (toto) then tata ...

the problem is in the last string comparison. if next_page is equal to organizer.asp.... it must jump to the alert function. the problem is that it never jumps to.
i'm sure of all the variables (i made an alert of what each variable contains before and the alert(next_page)function displays me very well "organizer.ASP?WCI=oAddLBTLocal&")

what's wrong ? is there a better way to test the diffeences between 2 strings ? is my test not enought ?

Best regards,
Elise
 
there is no astring.equals(anotherstring) function in jscript
the == should be working
you have to think of :
--> TRIM your string before the comparison (you don't "see" extra white spaces or \n or ...)
--> jscript is very case sensitive so you can try to uppercase or lowercase the whole string
good luck
 
thanks i've found the pb Best regards X-),
Elise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top