Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling one window from another 1

Status
Not open for further replies.

caseyc

Programmer
Apr 1, 1999
51
US
I am creating the member login area for the Web Developers Association of Chico California and I am limited to using javascript to password protect this area for Associate members only with the abscence of a cgi directory. The problem I have run across is after the login window pops up, the member may login, but I want the member area to load in the main window, not the 345x156 px. login window. Can somebody provide me with information on how to target windows using javascript?<br>
=&gt;The person with the correct answer will recieve the GRAND PRIZE!
 
Ok, create a frameset which only has one frame in it, so that it looks like there are no frames (unless you want there to be 2 frames). Name the only frame with the "name" attribute (I'll call it frame1), and make the src of the frame whatever you want your site to look like. Now, in your javascript, after the user has entered the correct password, use the "window.open" command like so:<br>
window.open(whatyouwant.html, "frame1");<br>
This will open the document "whatyouwant.html" in the desired window "frame1".
 
You could use the opener property of the new window, thus:<br>
<br>
In the page which contains the 'Members Login' link, include the following function and call this when the login button (or whatever) is clicked.<br>
<br>
function OpenLoginWindow() {<br>
NewWindow = window.open(&quot;&quot;,&quot;LoginWindow&quot;,&quot;width=400,height=200&quot;,&quot;resizable=no&quot;);<br>
NewWindow.location.href = &quot;login.htm&quot;;<br>
if (NewWindow.opener == null) NewWindow.opener = window;<br>
}<br>
<br>
<br>
login.htm is the pop-up password entry window.<br>
In this page, when the user enters their info. and clicks 'enter' call the following function:<br>
<br>
function go(url) {<br>
opener.location.href = url;<br>
window.close(&quot;LoginWindow&quot;);<br>
}
 
I have a similar situation. I want the javascript to open a pre-known URL in a new window, AUTOMATICALLY enter the login & password (from data in the script) into known fields in the form, AUTOMATICALLY click the submit button (or whatever it is) then email the resulting page to an email address in the script. <br>
<br>
I do not know how to make a script SEND a mouseclick to a button. THANKS!!!
 
I don't think what you are suggesting can be done. What you can do, however, is bypass the login screen by sending the information directly to form handler. But as far as a script automatically entering the information, I don't think it can be done. I could be wrong, though. <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= HomePage</a><br>WebMaster - DataBase Administrator - Programmer<br>
 
I thought about sending the information directly to the form handler. So you would have to know the name of the form, the name of the fields that you enter login/password in, and then you would code it in parameter notation, right? <br>
<br>
Will this always work? Presumably the form handler is a cgi script, a black box beyond our control. Every time I've written one of these I've put in special code to &quot;listen&quot; for parameters. Is it transparent to them whether the user typed in a form or whether somebody entered a command line. I guess the best thing to do is try it, eh? <br>
<br>
Would this be secure? <br>
<br>
Thanks... Why do I always want to do the things that can't be done!?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top