View Full Version : refresh parent window
vmihai
09-09-2002, 02:31 PM
I create a popup window like follow:
a href="javascript:window.open('login.html','Login','width=280,height=160')">accés clients</a>
Is possible to get data (a variable) from the popup banner when it is closed or validated?
And to perform a refresh on the parent window?
Any example greatly appreciated!
Mihai
:)
beetle
09-09-2002, 03:42 PM
If you are actually using the popup window as as a login page, you really don't need either of those methods. A simple solution would looke something like thisfunction checkLogin(f) {
if (f.username.value == 'username' && f.password.value == 'password') {
top.opener.location.href="page.htm";
top.close();
}
else
alert("Invalid Username and Password");
}
<form>
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
<input type="button" value="Login" onClick="checkLogin(this.form);" />
</form>Of course, it's typically not a good idea to use javascript for secure login system
However, to answer your questions directly, to create a varaiable in the parent window from the popup, use thistop.opener.window.variableName = value;To refresh the parent window from the popup, use thistop.opener.reload();
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.