How to verify "Contains" using JavaScript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1789945/javascript-string-contains">JavaScript: string contains</a>  </p>
</blockquote>



<p>In the below code I have to check whether the textbox contains <code>@</code> and <code>.</code>. I tried writing the below code which is not working. Anybody please do provide me with the correct syntax.</p>

<pre><code>    function emailval(objval) {
        if (obj.value.contains("@") &amp;&amp; obj.value.contains(".")) {
            document.getElementById(mid).style.backgroundColor = "#BDD470";
        }
        else {
            document.getElementById(mid).style.backgroundColor = "#CC0505";
        }
    }

&lt;/script&gt;

Enter text (Enter your email):
&lt;form id="form1" runat="server"&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;asp:TextBox ID="TextBox1" onkeyup="return emailval(this)" runat="server"&gt;&lt;/asp:TextBox&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/form&gt;
</code></pre>
