Solved

use SetTimeout to close popup with frameset

Posted on 2000-04-06
7
381 Views
Last Modified: 2013-11-19
Anyone know how to get settimeout to self.close a popup that has a frameset?  Code that works for a regular window doesn't work.

I need to make this window close in a certain amount of time - and keep the user from keeping it open.

If i can fix the frameset problem,
i'll probably use a window with no toolbar and block right clicks.

I need to prevent a refresh reset of the timer.

The aim is to allow a user access to the popup window's content for a strict period of time - then forcing it closed.

Thanks
0
Comment
Question by:unending
  • 3
  • 3
7 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2689064
setTimeout('top.close()',60000);

Michel
0
 
LVL 19

Accepted Solution

by:
daveamour earned 50 total points
ID: 2689070
Is this any help

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>

<Script Language="JavaScript">
<!--
  function newWindow()
  {
    x = window.open ("http://localhost/mysite/default.htm","NewWin","Width=400,Height=300");
    ID = window.setTimeout ("x.close();", 10000);
  }
//-->
</Script>

</HEAD>
<BODY>

<P>Click the New window Button</P>
<P>This will open a new window containing a frameset.  The window will then close in 10 seconds</P>
<P><Input Type="Button" Value="New Window" onClick="newWindow();">

</BODY>
</HTML>

Cheers

Dave
0
 

Author Comment

by:unending
ID: 2692032
i tried the basic settimeout approach.
didn't work.
however, the comment by daveamour did solve my problem.
i don't know how to give the points to him though.

thanks dave!
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:unending
ID: 2692035
just noticed how to
"accept comment as answer".
thanks again.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2692480
It didn't work how???

I assume you tried

<body onLoad="setTimeout('top.close()',60000); ">
in the popup???

Michel

0
 

Author Comment

by:unending
ID: 2696920
note to mplungjan:

i tried your suggestion.
the code in the popup frameset:

<HTML>
<HEAD>


<TITLE>splash</TITLE>
</HEAD>
 

<FRAMESET COLS="250,*" BORDER="0" FRAMEBORDER="0" FRAMESPACING="0">

<FRAME NAME="search" SRC="menu.asp" SCROLLING=AUTO noresize MARGINWIDTH="0" MARGINHEIGHT="0" ALIGN="TOP">

<FRAME NAME="center" SRC="splash.asp" SCROLLING=AUTO MARGINWIDTH="0" MARGINHEIGHT="0" ALIGN="TOP">
</FRAMESET>

<body onLoad="setTimeout('top.close()',5000);">

</BODY>

</HTML>

_______

the window does not close.
but if i made an obvious coding error,
it wouldn't be the first time!
thanks for your help in any case.
d.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2697663
Very obvious.

You cannot have a body tag in a frameset (except in the noframes part and there javascript is ignored)

The body onload belongs in the menu or splash.asp!!!

Michel
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question