View Single Post
Old 07-30-2012, 05:22 AM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,200
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Oh...okay.

Code:
var images = document.getElementsByTagName("img");
var found = false; // or null
var lookFor = /xxxx.jpg$/i;

for ( var i = 0; i < images.length; ++i )
{
    if ( lookFor.test( images[i].src ) 
    {
        found = true; // or found = images[i] if you want a reference to it 
        break;
    }
}
if ( found ) ... 
or 
if ( found != null ) ...
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote