?
Solved

auto close confirmation dialog

Posted on 2008-06-22
6
Medium Priority
?
3,621 Views
Last Modified: 2013-11-19
Hi,
I have a confirmation dialog. It is being used to warn the user about a time consuming operation, and confirm that he wants to proceed. The problem is that the dialog window does not close until all the JavaScript on the page stopped executing.

How is it possible to close the dialog window or set a time limit, etc.?

function verify()
{
  var result= confirm("This operation may take up to one minute. Do you want to proceed?");
  if (!result)
  {
    exit();
  }
  
}
//The dialog window is not closed after the function finishes executing. //It is closed only after all javascript on the page stops running.

Open in new window

0
Comment
Question by:msosno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 21843635
Check this:


function verify(){
  if(confirm("This operation may take up to one minute. Do you want to proceed?")){
     setTimeout("doTheComputation()", 10);
  } else {
     setTimeout("exit()", 10);
  }
}
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 21843643
I do not know your exit() function but perhaps it does not work globaly.
Then check this:

function verify(){
  if(confirm("This operation may take up to one minute. Do you want to proceed?")){
     setTimeout("doTheComputation()", 10);
  } else {
     exit();
  }
}
0
 
LVL 16

Expert Comment

by:Lolly-Ink
ID: 21851373
You can't use the JavaScript confirm method for this. The confirm method stops JavaScript from executing. You'll have to use a floating div element with content to simulate a dialog box. Examples can be found by performing an internet search with tags: JavaScript close alert OR confirm.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:msosno
ID: 21851807
Zvonko: Thanks, everything works.
Is there a way to end script execution?
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 21852984
No, there is not. You can only exit the current function with the return statement. In the return statetement you can pass a return value. Depending on that return value can the calling function do a return exit to the next calling level. But you canot kill the parent calling function execution levels.
http://home.cogeco.ca/~ve3ll/jstutor3.htm
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 21852987
Or short: use return statement to exit the function execution.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

765 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