Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: I Need New Eyes


Message #1 by "Alex Scher" <alex@m...> on Tue, 18 Dec 2001 11:20:57 -0500
&& || != >= <= 

arrghh!!

-----Original Message-----
From: Alex Scher [mailto:alex@m...]
Sent: Tuesday, December 18, 2001 11:44 AM
To: javascript
Subject: [javascript] RE: I Need New Eyes


That did the trick!  I think I missed the reverse logic: Either condition
could be true, but both had to be false for the whole test to be true.  I
think I'm getting dizzy......

Thanks!

-----Original Message-----
From: O'Hara, Elliott M [mailto:EMOHARA@k...]
Sent: Tuesday, December 18, 2001 11:30 AM
To: javascript
Subject: [javascript] RE: I Need New Eyes


 if((ext != ".gif")&&(ext != ".jpg")){ // This is the test in question
      alert("Logo must be a gif or jpg")
  	  return false
    }
  }
return true



Isn't that what you want? Or am i dumb? (don't worry about insulting me:o)
I'm a big boy....
-----Original Message-----
From: Alex Scher [mailto:alex@m...]
Sent: Tuesday, December 18, 2001 11:21 AM
To: javascript
Subject: [javascript] I Need New Eyes


Hello,

I am having difficulty seeing the issue with this code, and I have a feeling
it's painfully obvious.

I am testing the value of the variable "ext", to make sure it ends in ".gif"
or ".jpg".  When I display the value of ext in an alert box, it returns the
correct value of what I am testing with.  However the test always returns
false.  I am at a loss to explain why the test failed.  Any suggestions from
your eyes??

if(addform.logo.value != ""){
    var ext = addform.logo.value.substring(addform.logo.value.length -
4,addform.logo.value.length)
        ext = ext.toLowerCase() // Make the test case insensitive

    if((ext != ".gif")||(ext != ".jpg")){ // This is the test in question
      alert("Logo must be a gif or jpg")
  	  return false
    }
  }
return true






  Return to Index