Possible Duplicate:
JavaScript: string contains
In the below code I have to check whether the textbox contains @
and .
. I tried writing the below code which is not working. Anybody please do provide me with the correct syntax.
function emailval(objval) {
if (obj.value.contains("@") && obj.value.contains(".")) {
document.getElementById(mid).style.backgroundColor = "#BDD470";
}
else {
document.getElementById(mid).style.backgroundColor = "#CC0505";
}
}
</script>
Enter text (Enter your email):
<form id="form1" runat="server">
<br />
<br />
<asp:TextBox ID="TextBox1" onkeyup="return emailval(this)" runat="server"></asp:TextBox>
<br />
<br />
</form>