Write this javascript code inside "HEAD" - "SCRIPT" tag
function checkEmail(myForm)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.TextBox1.value))
{
return (true)
}
else
{
alert("Enter valid Email id please.")
TextBox1.focus()
return (false)
}
}
call this function in form's onsubmit event
form id="myForm" runat="server" onsubmit="return checkEmail(this)"
Get C#, ASP.NET, HTML, JavaScript, XML, WCF, Web services and Ajax tips.
menu
- Home
- Asp.Net
- MVC
-
C#
- Ref
- Constructor
- Constructor Program
- Jagged Array
- Command Line Argument
- Stack and Heap
- Ref and Out
- Const, ReadOnly and Static
- Generic
- Two Interfaces With Same Method Name
- Inheritance
- Is Keyword
- Custom List with OnAdd Event
- Data Annotation
- Covariance & Contravariance
- Signing - Strong vs Weak Reference
- Sorting List by IComparable vs IComparer
- WCF
- JavaScript
- SQL
- Others
- Contact
It is very nice post.It is good post. It is simple and best. It helpful for future use.You can test your knowledge in html by attending HTML Quiz .
ReplyDelete