Creating a pop-up login window.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
maxpax
Forum Newbie
Posts: 18
Joined: Tue Aug 01, 2006 5:38 am
Location: England

Creating a pop-up login window.

Post 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.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
maxpax
Forum Newbie
Posts: 18
Joined: Tue Aug 01, 2006 5:38 am
Location: England

Post by maxpax »

Cool thanks I'll have a look at their code.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post 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?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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';
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply