Con chrome e Internet explorer non ho problemi ma con Firefox, quando apro la pagina, questa viene caricata all'infinito cioè sembra che stia finendo di caricare, ma non riesco a capire il motivo.

Questo è il sorgente HTML
codice:
<html>

	<head>
		<script type="text/javascript" language="javascript" src="script.js">

		</script>
	</head>
	
	<body>
		<input type="button" value="Apri finestra di dialogo" onclick="pass();">
	</body>

</html>
Questo è lo script
codice:
var password;


function controllo(){

if(frmmain[4].value=="" ||  frmmain[5].value=="" ||  frmmain[6].value=="")
{
alert("Inserire tutti i campi obbligatori");
return 0;
}
if(password==frmmain[6].value)
alert("Congratulazioni, hai indovinato la password");
else
alert("Congratulazioni, hai sbagliato la password");

}


function pass(){
	password=prompt("Inserire la Password");
	document.write("<html><head><script type=text/javascript language=javascript src=script.js></script></head>");
	document.write("<body bgcolor=#000080 text=white>");
	document.write("<form name='frmmain'>");
	document.write("<table border=0>");
	document.write("<caption align=bottom><input type=button value=submit onclick=controllo();><input type=reset value=reset>
<font size=+1>I campi con * sono obbligatori</font></caption>");
	document.write("<tr>");
			document.write("<td><font size=+1>Nome</font></td>");
			document.write("<td><input type=text name=nome></td>");
		document.write("</tr>");
		document.write("<tr>");
			document.write("<td><font size=+1>Cognome</font></td>");
			document.write("<td><input type=text name=cognome></td>");
		document.write("</tr>");
		document.write("<tr>");
			document.write("<td><font size=+1>Codice Fiscale *</font></td>");
			document.write("<td><input type=text name=codice_fiscale></td>");
		document.write("</tr>");
		document.write("<tr>");
			document.write("<td><font size=+1>User name *</font></td>");
			document.write("<td><input type=text name=utente></td>");
		document.write("</tr>");
		document.write("<tr>");
			document.write("<td><font size=+1>Password *</font></td>");
			document.write("<td><input type=password name=passwd></td>");
		document.write("</tr>");
	document.write("</table>");
	document.write("</form>");
	document.write("</body>");
	document.write("</html>");
}