Page 1 of 1

Creating a pop-up login window.

Posted: Mon Aug 07, 2006 2:01 am
by maxpax
OK, I hope I can expalin what I want to do.

I have got a page on my website which has a log-in button, when this button is clicked I want a window to pop-up which enables the user the login. After the have typed in their username and password and it has been confermed I want the popup window to close autmatically, or stay there to let the user try again if the information they entered was wrong.

Now I know this bit is possible, but I would like to take it further if possible:

This leaves the user on the page where they clicked the log-in button. After the log-in window closes I want this page to change to another page (not loading another window). SO at the end of it the user hasn't had to open or close any windows and they end up with only one window open.

I know the first bit is possible but I am not sure about the second bit.

I have got some code for opening and closing windows:
Open:

Code: Select all

<script type="text/javascript">
	function openwindow() {
	window.open ("./loginpage.php","openwindowname","width=200,height=200,scrollbars=no,resizable=no");
	}
</script>
Close:

Code: Select all

<script type="text/javascript">
	function closewindow() {
	window.close()
	}
</script>
Can anyone help me with creating this. Just incase you need to know I will be using php for the logon system.

Posted: Mon Aug 07, 2006 2:18 am
by s.dot
Give your parent window a target name, and use the target attribute of the form to send the data where you want.

Posted: Mon Aug 07, 2006 2:33 am
by RobertGonzalez
You know, the PM notification popup that phpBB uses does exactly what you are asking for (in terms of returning the user to a page that redirects onFocus). You may want to have a look at their code.

Posted: Mon Aug 07, 2006 6:55 am
by maxpax
Cool thanks I'll have a look at their code.

Posted: Tue Aug 08, 2006 2:18 am
by jmut
is it not possible to use floating div or something....and not actually popup other window.
is there some pitfall with this approach?

Posted: Tue Aug 08, 2006 10:45 am
by pickle
In your closewindow() function, try adding:

Code: Select all

window.opener.location.href = 'absolute or relative url of page to forward user to';