Hi Guillaume,

The problem has been resolved. The second string contained some blank spaces
which make it different from the other string, so i removed them and end of
the problem.

thanks for your answer.

Abraham

On Tue, Sep 23, 2008 at 1:56 PM, Guillaume Rosauro <[EMAIL PROTECTED]>wrote:

> String comparison with == operator is legal but it compares the 2
> references.
>
> What is your result with string1.equals(string2) ?
>
>
>
>
>
>
> On Mon, Sep 8, 2008 at 12:27 PM, Abraham Rodriguez Mota <
> [EMAIL PROTECTED]> wrote:
>
>> Hi all,
>>
>> I am trying to compare two strings but the comparison operator always
>> returns false. I printed the values using the alert function and the strings
>> are read properly but the result is always false even when they are equal.
>> The comparison works when I compare the var values with static strings
>> -(i.e: currentId=='c1c2'), but not when comparing the two
>> variables-(currentId==elementID). I have tried to cast the values to strings
>> and use the localeCompare method but it didn't work.  Any help will be
>> really appreciated.
>>
>> function updateConnections(targetElement){
>> //Reading custom metadata, name space xxx
>> var relation=targetElement.getElementsByTagNameNS(xxx,'rel');
>> var elementID;
>>
>> var currentId=relation.item(0).firstChild.nodeValue;
>> var updateRelation=relationsGroup.getElementsByTagName('line');
>>
>> if(updateRelation.length>0){
>>
>> for(var i=0;i<updateRelation.length;i++){
>>
>> elementID=updateRelation.item(i).getAttribute('id');
>> //variable's content change
>> alert(elementID +" " + currentId+ "   ");
>> //but this is always false
>> alert(elementID == currentId);
>>
>>
>> //Here is the problem
>> if(currentId==elementID){
>> alert(elementID+currentId);
>> }
>>
>> elementID=' ';
>> }
>> }
>> }
>>
>> thanks a lot
>>
>> Abraham
>>
>
>

Reply via email to