Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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?

irt.org | Knowledge Base | JavaScript | Password | Q307 [ previous next ]

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?

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.