Important alert: (current site time 7/15/2013 2:02:08 PM EDT)
 

VB icon

Get login name/password in popup and return result

Email
Submitted on: 6/5/1998
By: Found on the Web 
Level: Not Given
User Rating: By 7 Users
Compatibility: JavaScript
Views: 36559
 
     How can I capture a login name and password in a popup window and then pass it onto the next page? Found at: http://www.irt.org
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Get login name/password in popup and return result
' Description:How can I capture a login name and password in a popup window and then pass it onto the next page? 
 Found at: http://www.irt.org
' By: Found on the Web
'**************************************

initial.html: 
<SCRIPT LANGUAGE="JavaScript"><!--
var loginname = '';
var loginpassword = '';
function windowOpen() {
var myWindow=window.open('popup.html','windowRef','width=200,height=200');
myWindow.location.href = 'popup.html';
if (!myWindow.opener)
myWindow.opener = self;
}
function go(url) {
location.href = url + '?' + loginname + '&' + loginpassword;
}
windowOpen();
//--></SCRIPT>
<A HREF="javascript:go('nextpage.html')">go to next page</A>
 
popup.html: 
<SCRIPT LANGUAGE="JavaScript"><!--
function returnDetails() {
opener.loginname = document.myForm.loginname.value;
opener.loginpassword = document.myForm.loginpassword.value;
self.close();
}
//--></SCRIPT>
<FORM NAME="myForm">
Name: <INPUT TYPE="TEXT" NAME="loginname">
Password: <INPUT TYPE="PASSWORD" NAME="loginpassword">
<INPUT TYPE="BUTTON" VALUE="ENTER" onClick="returnDetails()">
</FORM>
 
nextpage.html: 
<SCRIPT LANGUAGE="JavaScript"><!--
var start = location.search.indexOf('?');
var end= location.search.indexOf('&');
var loginname = location.search.substring(start+1,end);
var loginpassword = location.search.substring(end+1);
alert('Name = ' + loginname + '\n' + 'Password = ' + loginpassword);
//--></SCRIPT>


Other 219 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

4/29/2002 1:27:18 PMDevin Quick

how did you get 5.5 stars out of 5?
(If this comment was disrespectful, please report it.)

 
11/6/2004 5:59:44 AMPhilip Hughes

I love it!

LOL how did you get 5.5 stars out of 5?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.