To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-04-2006, 07:06 AM   #1
hanhao
Junior Member
 
Join Date: May 2006
Posts: 16
self closing a window

ok i need to self close a window (like after 5 seconds)

anyone knows the command to close the window?

would

PHP Code:
echo "self.close()";
?

be correct?

- hanhao
hanhao is offline   Reply With Quote
Old 06-04-2006, 07:37 AM   #2
Weedpacket
Custom User Title™
 
Weedpacket's Avatar
 
Join Date: Aug 2002
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,137
PHP can't do this because it doesn't know what a "window" is.

Javascript could do it, though. Something like
HTML Code:
<script type="text/javascript">self.close();</script>
Though you'll probably need to search the net a bit to see how Javascript does timers (I can never remember, so that's what I end up doing every time I need to do it. SetTimeout() or something like that.)
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.

Last edited by Weedpacket; 06-04-2006 at 07:55 AM.
Weedpacket is offline   Reply With Quote
Old 06-08-2006, 09:46 PM   #3
bradgrafelman
Pna lbh ernq guvf?
 
Join Date: Jul 2004
Location: 40.566N -89.731W, ~469ft above sea level
Posts: 11,491
Yeah... I have trouble with it too, so here's my guess:
HTML Code:
<script type="text/javascript"> setTimeout("self.close()", 5000); </script>
__________________
***If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"***

"Well Bones, do the new medical facilities meet with your approval?" -- Kirk
"They do not. It's like working in a damn computer center" -- McCoy (Star Trek: TMP)

Useful links: Debugging 101 || NJOE || (Sig image) || Rolla Engineered Solutions, LLC
bradgrafelman is offline   Reply With Quote
Old 06-08-2006, 11:23 PM   #4
JPnyc
Administrator
 
Join Date: Jan 2005
Posts: 963
That is the correct syntax, but be aware that you can only close a window with scripting, that you opened. You can't close the initial window used to navigate to your site. IE will throw up a prompt asking if the user wants to allow, and the other major browsers just ignore it.
__________________
PHP builder Online Community Manager

JPnyc is online now   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 05:39 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.