compare alphanumeric problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arnabprabhat
    New Member
    • Jun 2008
    • 1

    compare alphanumeric problem

    [CODE=javascript]var a=document.getE lementById("cmb State3"); // some id
    if(a=="cmbState 3"){
    alert("Inside") ;
    }
    [/CODE]
    // it is not working .not comparing ..... any solution plz............ ..
    Last edited by gits; Jun 4 '08, 06:20 AM. Reason: added code tags
  • vikas251074
    New Member
    • Dec 2007
    • 198

    #2
    Hello,

    Your question is not clear. Please be specific and say clear question.

    Thanks and regards,
    Vikas

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5390

      #3
      this line of your code:

      [CODE=javascript]var a=document.getE lementById("cmb State3");[/CODE]
      returns you a dom-node-reference (an object) to variable a in case the method finds the node in your doc ... otherwise a will be null ...

      so you cannot compare a string with an object ... what do you really want to compare? any property or attribute of the node?

      kind regards

      Comment

      Working...