Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old April 17th, 2005, 04:15 PM
jweizenblut jweizenblut is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Miami, Fl. US
Posts: 522 jweizenblut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 29 sec
Reputation Power: 2
Send a message via AIM to jweizenblut Send a message via Yahoo to jweizenblut
Close POP-UP

I have several pages on my site that link to pop-ups with different information.
I am looking for somekind of script that makes it so that if you click outside of the pop-up area. The pop-up is closed. I saw this once done in a site and can't remember what site it was. All I know was that when you clicked in the page that generated the pop-up, the pop-up would close.
Any ideas?

Reply With Quote
  #2  
Old April 18th, 2005, 12:41 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: Close POP-UP

use an onblur event in the body tag of the page loaded in the popup...

onblur="document.self.close()"

if I remember correctly though, even if to click the page that loads in the popup the popup will close. Play around with it to see if it will work for you.

Reply With Quote
  #3  
Old April 19th, 2005, 10:17 PM
spud spud is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Melbourne, Australia
Posts: 163 spud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Close POP-UP

what about in the main page, something like
<body onClick="popup.window.close()">
although if you haven't opened the popup yet, it'll probably give you a JS error.

<body onClick="if(popup)popup.window.close()">
might work, but i'm not sure...

Reply With Quote
  #4  
Old April 19th, 2005, 11:57 PM
jweizenblut jweizenblut is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Miami, Fl. US
Posts: 522 jweizenblut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 29 sec
Reputation Power: 2
Send a message via AIM to jweizenblut Send a message via Yahoo to jweizenblut
RE: Close POP-UP

Tried it, and it unfortunately doesn't work.
I know this is possible because I once saw it on a site. But, can't for the life of me remember which site it was.
Any other ideas?

Reply With Quote
  #5  
Old April 22nd, 2005, 12:18 AM
spud spud is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Melbourne, Australia
Posts: 163 spud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Close POP-UP

okay, i think i've got it.
<a href="#" onClick="someName = window.open('page','name','etc');">open window</a>

<a href="#" onClick="someName.close();">close window</a>

does that make sense?

again, there's still a problem with if the "someName" window hasn't been opened.

this works in IE, but my school doesn't have firefox so i couldn't test it in that.

Reply With Quote
  #6  
Old April 22nd, 2005, 12:57 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: Close POP-UP

I just tested my earlier suggestion and your right, it did not work...because I made a mistake!!. try this in the body tag if the popup page.

onblur="self.close()"

I tested it in in IE and Firefox and it worked for both. The window closes if the main window (or any other window for that fact) gets focus.

Reply With Quote
  #7  
Old April 24th, 2005, 02:20 PM
jweizenblut jweizenblut is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Miami, Fl. US
Posts: 522 jweizenblut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 29 sec
Reputation Power: 2
Send a message via AIM to jweizenblut Send a message via Yahoo to jweizenblut
RE: Close POP-UP

Cool. Works now. Thanks a million!

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Close POP-UP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway