|
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>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.