I’m trying to make a quick script that will stop certain domains from being entered into a form. I pieced together the script below but it doesn’t seem to work. I’m figuring it must be in the loop but I’m missing something. Any ideas?
[CODE]
function grabDomain(selectURL) {
var notURL = new Array()
notURL[0] = “tompegx.com”;
notURL[1] = “sysdvd.com”;
notURL[2] = “dvdtompegx.com”;
notURL[3] = “yaomingsoft.com”;
notURL[4] = “cutedvd.com”;
notURL[5] = “cnn-video.com”;
notURL[6] = “usa-download.com”;
notURL[7] = “tomp4.com”;
notURL[8] = “foxeasy.com”;
var the_url = document.addform.URL.value
var lead_slashes = the_url.indexOf(“//”);
var domain_start = lead_slashes + 2;
var without_resource = the_url.substring(domain_start, the_url.length);
var next_slash = without_resource.indexOf(“/”);
var domain = without_resource.substring(0, next_slash);
for (var i=0; i<selectURL; i++)
if (domain==notURL[i])
alert(“this domain is not allowed”);
}
<form name=”addform” action=”#” method=post>
<input name=”URL” value=”http://” size=”40″>
<input type=”submit” name=”add_record” onclick=”grabDomain();” value=”Submit”>
</form>