+1 vote
468 views
in Programming by Expert (5.1k points)
i need a personal email validation script . that means , gmail,hotmail,yahoo,rediff, not allowed.

1 Answer

0 votes
by Expert (5.9k points)

Firstly  I would say you should elaborate your question more so that any one can give you the correct solution which you want. Any way as I understood you need a validation script that can validate your these words gmail,hotmail,yahoo,rediff.

 

See this script you can get idea how you can make validation:

 

<script type="text/javascript">

function validate()

{

var cars = ["hotmail.com", "yahoo.com", "rediff.com"];

var x = document.getElementById("txt").value

var res = x.split("@");

 

if (cars.indexOf(res[1]) > -1) {

 alert("Word found in string");

} else {

   alert("Word not found");

}


 

}

</script>

<form action="" method="post" onsubmit="return validate()">

<input type="text" id="txt" name="txt">

<input type="submit" value="submit">

</form>

 

Now if user is using any id with @yahoo.com or @hotmail.com etc user will get alert.

Modify the script as per your need.


 

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated