All browsers are generating that error. Of the browsers that report errors in a console, only Firefox preserves previous errors upon navigation by default. Chrome can be toggled but defaults to a fresh console window upon navigation. Other browsers may or may not be able to be toggled in this manner. Navigation occurs when the form is submitted.
The form submits because the form has:
Code:
onsubmit="return displayMessage();"
Which means it will submit unless displayMessage returns false.
The displayMessage() function always returns undefined, as it has no return value set, except for this section:
Code:
if(document.my_form.uri.value==0)
{
document.write("<font color='red'><i>Please enter URL/Domain Name/IP Address.</i></font>");
return false;
}
Which only fires in older browsers that do not recognize the required attribute of the uri input element. Modern browsers will not submit the form because of that if the uri field is not filled in.
If that field is filled out, then this happens:
Code:
document.write("<DIV id='loading'><BR><BR><font color='#FF6600'><i>Please wait... The ports are being scanned...</i></font></DIV>");
document.getElementById("my_form").submit();
When you document.write after a page is already loaded (which this page must be, because otherwise the form wouldn't be there), it wipes out the existing page and replaces it with whatever is written. So, although in some browsers the form submits because the form is in memory and this function returns undefined, by the time the code gets to:
Code:
document.getElementById("my_form").submit();
"my_form" is not there any more, it has been overwritten. Hence the error you are seeing. In Firefox though the form is not in memory so does not submit, so all you see is the loading message and the error.
I think I see what you want it to do though. When I have some more time I may try rewriting it to do that. Or you could just use a standard form validation script. There are many available around the web.
Just to get it working, replace the script with:
Code:
<script type="text/javascript">
function displayMessage()
{
if(document.forms.my_form.uri.value==0)
{
alert("Please enter URL/Domain Name/IP Address.");
document.forms.my_form.uri.focus();
return false;
}
alert("The ports will be scanned when you dismiss this alert.");
return true;
}
</script>
The browser cache may need to be cleared and/or the page refreshed to see changes.
Bookmarks