Welcome to WebmasterWorld Guest from 3.227.2.109

Forum Moderators: open

Message Too Old, No Replies

Javascript and pop ups

     
9:08 pm on Feb 8, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 11, 2004
posts:71
votes: 0


i have a some code
<form><td colspan='2'><input type='button' onClick=javascript:window.open(\"calendar.php\",\"name\",\"attributes\") name='button' value='Book' /></td></form>

(it is echoed in php)

the thing is when a link is clicked on the pop up i want it sent back to the original page and the pop up closed...

can anyone gimme a hand

11:09 pm on Feb 9, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 11, 2004
posts:71
votes: 0


*BUMP*

please :D

6:14 pm on Feb 10, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


First off - you have a form, then a TD without a table, that will generate a nesting error on validation. (diff. issue.)

ATM I don't have the time to code it out, but here is what should work:

1. Remove the window open from the link and call a function. This "base page" is going to be referenced later as it is the "opener" for step 2 and 3.
2. In the function, create a new window and open calendar.php.
3. In the calendar.php file, you need to add some code that references the window.opener and executes a window.close.

VERY rough, but the structure is:

Main file:

<form><input type='button' onClick="myWin('calendar.php');" name='button' value='Book' /></form> ....
...

function myWin (page) {
var win=open (page,id,params);
}

In calendar.php . . .

<a href="goToAndClose('goto.html');">Go to page</a>

.....

function goToAndClose(url) {
if (window.opener &&! window.opener.closed) {
window.opener.location=url;
window.close(); // this should close this window - the pop-up
}
}

Like I said very rough, go forth and debug. :-)

}

10:52 pm on Feb 10, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 11, 2004
posts:71
votes: 0


thanks a lot i will take a look when i get home :D

richardhen

10:03 am on Feb 11, 2005 (gmt 0)

Inactive Member
Account Expired

 
 


I have a simlar problem .... did this work?
12:10 am on Feb 12, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 11, 2004
posts:71
votes: 0


wow this worked fantasticly well thanks a lot :D