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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close Pop-up

Status
Not open for further replies.

perlkid

Programmer
Mar 9, 2000
35
US


Hello,

I have a login prompt in a pop-up window. The form in it is targeted to a cgi in the background. If they type in the wrong user/pass then an error message appears in the main frame in the background, but if they type in the right user/pass then I want the window to close when the successfully accessed page loads. I tried this.

var remote.close()

and putting an onload tag in the body.

I'm new to java script as you can see.

var remote = window.open is what the pop-up window from the home page uses. I though that var remove is the name of the child window.

So overall this is what I need to acomlish,

1. Home page, user can click login link.
2. in a pop-up window a login screen appears.
3. They type in the right user-pass then the page loads in the main frame, and on the page in the main frame is the java script that closes the pop-up window.
4. If the type in wrong pass nothing happends.

The only part I need help with is the closing window part.

So please help.

Sorry For My Vauge Explanations and Example, I don't know much about java script.

Thanks Much,

perlkid [sig][/sig]
 
If I were you, I'd do it this way:

Have a link to a JScript-opened window from the main frame. On it, have the login boxes. The submit button is just a normal form-submit button that goes to the same (ASP) page. The server-side script checks if it's valid. If it's not, just show the login boxes again. If it is valid, set the session up for that user, then close the window and refresh the window's "opener".

Happy coding!



~BenDilts( void ); [sig][/sig]
 
By the way, the closing code would look something like this:

function closeMe()
{
close();
opener.window.navigate('mainpage.asp');
}

Sorry if it's a little off, it's off the top of my head.
Any more help needed about this, just ask!

[sig][/sig]
 
Thanks BeanDog,

I can't do it the way you would because I'm too far into it with the way I have it now. :)

I added Onload="closeMe()" in the body tag, and put this in the head

function closeMe()
{
close();
}


Also tried with

opener.window.navigate('
But I got an error an it didn't close the window.

Is there anything else I can try?

Thanks Mate!

perlkid [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top