Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2002
    Location
    Washington State
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Finding if a value has a value - Does Image SRC contain a "1"?

    I am trying to figure out how to check if a value has a value. Like if an image src has a "1" in its value. Kind of like below even though this one doesn't work:


    if(document.getElementById("MyID").src contains "1"){
    DO THIS...
    }
    else{
    Do THAT...
    }


    Any comments or suggestions are greatly apreciated. Thanks.


    ~Isaac Lloyd~
    ~ Isaac Lloyd ~
    Website Design & Development
    http://www.IsaacLloyd.com

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    if(document.getElementById("MyID").getAttribute('src').indexOf('1')>-1)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •