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>
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.