<script language="javascript">
function validate(form_id,email) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.forms[form_id].elements[email].value;
if(reg.test(address) == false) {
alert('Invalid Email Address');
return false;
}
}
</script>
<body>
<form id="form_id" method="post" onsubmit="javascript:return validate('form_id','email');">
<input type="text" id="email" name="email" />
<input type="submit" value="Submit" />
</form>
</body>
WEBSITE VALIDATION
------------------------------------
function validate()
{
var reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?$/;
var address = document.getElementById("email").value;
if(reg.test(address) == false) {
alert('Invalid Email Address');
return false;
}
}
{
var reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?$/;
var address = document.getElementById("email").value;
if(reg.test(address) == false) {
alert('Invalid Email Address');
return false;
}
}