There is a much much easier way to do all that.
First, just put the <form> right on the same page as the quiz. Notice the
target= that I added.
Code:
<form id="Results" action="http://fp1.formmail.com/cgi-bin/fm192" method="post" target="sendResults">
<input type="hidden" name="_pid" value="******">
<input type="hidden" name="_fid" value="******">
...
</form>
Add an <iframe> to your page, thus:
Code:
<iframe name="sendResults" style="height: 1px; width: 1px; visibility: hidden;"></iframe>
And then your code to send the form looks like this:
Code:
function SendResults(Score)
{
var form = document.getElementById("Results"); // named forms are obsolete; use id
form.Score.value = Score + '%';
form.realname.value = UserName;
form.End_Time.value = (new Date()).toLocaleString();
form.Start_Time.value = StartTime;
form.submit();
}
Now you don't have to depend upon a popup working. So long as the browser supports <iframe>s (and no modern browser does not) it works.
Now...
If the submittal of the <form> results in something that you *WANT* the user to see, then you don't want a 100% hidden <iframe>, as I have it there, do you?
Okay, simple enough:
Code:
<iframe id="sendResults" name="sendResults" style="height: 400px; width: 400px; display: none;"></iframe>
Notice that now it has an id as well as a name. (That name is needed for the
target= in the <form> tag.)
And so, you just tack this line in at the end of the SendResults function:
Code:
document.getElementById("sendResults").style.display="block";
}
So that the <iframe> turns visible to display the results of the <form> posting.