[thelist] JS Help: window.close inside an event

Dave McLean dave at members.evolt.org
Thu Sep 20 11:35:46 CDT 2001


Hello all,

I'm working on a site that has a quiz built by a third-party piece of
software. The s/w created a Javascript frameset where all the action
happens. I've got it working to my desire except for one thing.

Once the user finishes the quiz the page sends the results (anonymously) to
formmail without telling the user. The third-party software has set it up so
a pop-up window opens... which is frustrating because it will more than
likely confuse the audience (Kindergarten to Grade 3 teachers).   I've tried
to take the pop-up out of the code, but I'm no javascript wizard by any
means. 

Is there any way in the script to have it process in the parent window and
not spawn a child window? I've done a little dissecting, but so far
nothing's worked.

The page is now located at:
http://www.fwj.com/workshop/abmilk5/trg/newposttest/index.htm

If you're interested in actually taking the quiz, the answers are:
<warning type="spoiler">B,D,C,C,B,D,B,B,B,B</warning>

The function for opening the new window is here:

function SendResults(Score){
var today = new Date;
    var NewName = '' + today.getTime();
      var NewWin = window.open('', NewName,
'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=y
es,resizable=yes,,width=400,height=300');

    NewWin.document.clear();
    NewWin.document.open();
    NewWin.document.write(ResultForm);
    NewWin.document.close();
    NewWin.document.Results.Score.value = Score + '%';
    NewWin.document.Results.realname.value = UserName;
    NewWin.document.Results.End_Time.value = (new Date()).toLocaleString();
    NewWin.document.Results.Start_Time.value = StartTime;
    NewWin.document.Results.submit();

}


Could I simply add this line at the end of the function?

NewWin.document.self.close();

Any help y'all can offer is mighty appreciated.

Thanks,
Dave

<tip type="Get a life... sort of.">Visit thechat at lists.evolt.org some time.
We need some fresh new opinions and it's a great place to chat with your
fellow evolters about delicious barley & malts. evolt.org social events are
frequently announced there too.  thechat, you belong in there.</tip>






More information about the thelist mailing list