Re: TypeError: document.getelementbyid(...) is null

Sunday, October 13, 2013

The only error I'm getting is that you're trying to reference the 'loading' element in window.onload event when the element doesn't exist on the page yet. 

Try adding the 'loading' div in the page directly instead of writing it out with document.write in displayMessage. Then in displayMessage you can just set the style display value to " " or "block" etc. 

On Sunday, October 13, 2013 5:40:58 AM UTC-4, Abhijeet Muneshwar wrote:

<title>Port Scanner for Mozilla Firefox</title>

<form name="my_form" id="my_form" method="post" action="#" onsubmit="return displayMessage();">
<p align="center">URL/Domain Name/IP Address: <input type="text" size="20" name="uri" value="" placeholder="" required/></p>
<table align="center" border="1" width=100% bgcolor="#f4fff0" bordercolor="green" cellspacing="2" cellpadding="2">
<td align="center">
Start port: <input type="text" size="5" name="start_port" maxlength="5">
End port: <input type="text" size="5" name="end_port" maxlength="5"><br>
<input type="submit" value="Scan all ports" name="scan_all"><br>
<input type="submit" value="Scan only open ports" name="scan_open">
<td align="center">
<input type="text" size="20" name="scan_tcp"><br>
<font color="#b1b1b1">Enter port numbers separated by space. (e.g. 21 25 80)</font><br>
<input type="submit" value="Scan TCP ports" name="scan_tcp_ports">
<td align="center">
<input type="submit" value="Scan common service ports" name="scan_common_tcp"><br>
<input type="submit" value="Scan common Trojan ports" name="scan_common_trojan_tcp">
   <script type="text/javascript">
function displayMessage()
document.write("<font color='red'><i>Please enter URL/Domain Name/IP Address.</i></font>");
return false;
document.write("<DIV id='loading'><BR><BR><font color='#FF6600'><i>Please wait... The ports are being scanned...</i></font></DIV>");

I want to submit above form. But it shows me JavaScript error in Console that 
"TypeError: document.getelementbyid(...) is null"
This error is for code :

I am using Firefox 24.0 and Windows 7. I have installed only 1 add-on. That is 'Firebug 1.12.3'.
This code works fine for other browsers Except Firefox.
Please help me to solve this problem.

You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit


Post a Comment

Note: Only a member of this blog may post a comment.

Copyright © 2010 Web Design | Free Blogger Templates by Splashy Templates | Layout by Atomic Website Templates

Vida de bombeiro Recipes Informatica Humor Jokes Mensagens Curiosity Saude Video Games Animals Diario das Mensagens Eletronica Rei Jesus News Noticias da TV Artesanato Esportes Noticias Atuais Games Pets Career Religion Recreation Business Education Autos Academics Style Television Programming Motosport Humor News The Games Home Downs World News Internet Design Entertaimment Celebrities 1001 Games Doctor Pets Net Downs World Enter Jesus Mensagensr Android Rub Letras Dialogue cosmetics Genexus lasofia thebushrajr wingshock tripedes gorduravegetal dainfamia dejavu-transpersonal jsbenfica republicadasbadanas ruiherbon iranianforaryans eaystcheyl fotosdanadir Só Humor Curiosity Gifs Medical Female American Health Madeira Designer PPS Divertidas Estate Travel Estate Writing Computer Matilde Ocultos Matilde futebolcomnoticias girassol lettheworldturn topdigitalnet Bem amado enjohnny produceideas foodasticos cronicasdoimaginario downloadsdegraca compactandoletras newcuriosidades blogdoarmario arrozinhoii