Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q307 Is there a way to have a Pop Up window ask for a Name and Password and then send this infomation to a cgi script?

You are here: irt.org | FAQ | JavaScript | Password | Q307 [ previous next ]

In the main document:

<SCRIPT LANGUAGE="JavaScript"><!--
function windowOpen() {
    var myWindow=window.open('popup.html','windowRef','width=200,height=200');
    myWindow.location.href = 'popup.html';
    if (!myWindow.opener)
        myWindow.opener = self;
}

windowOpen();
//--></SCRIPT>

And then in the popup.html document:

<SCRIPT LANGUAGE="JavaScript"><!--
function returnDetails() {
    opener.location.href = 'whatever.cgi?login=' + escape(document.myForm.loginname.value) + '&password=' + escape(document.myForm.loginpassword.value);
    setTimeout('window.close()',500);
}
//--></SCRIPT>

<FORM NAME="myForm">
Name: <INPUT TYPE="TEXT" NAME="loginname">
Password: <INPUT TYPE="PASSWORD" NAME="loginpassword">
<INPUT TYPE="BUTTON" VALUE="ENTER" onClick="returnDetails()">
</FORM>

©2018 Martin Webb