javascript check whether an element contains certain string
<p>I am trying to search http links in images. If the image link contains a certain string in it, I want to check the checkbox associated with it:</p>

<p>I tried the following code but it does not work.</p>

<p>Here in the code below, I am trying to check the checkbox of the image if the image link contains the string "google".</p>

<p>How can I do that?</p>

<p>Thanks</p>

<pre><code>for (i=0; i&lt;document.getElementsByTagName('div').length; i++) 
  {

    if(document.getElementsByTagName('img')[i].evaluate(contains(@src, 'google'))
    {

        if(document.getElementsByTagName('input')[i].type=='checkbox')
        {
        document.getElementsByTagName('input')[i].checked =true;
        }
    }

  }
</code></pre>
