Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6180229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:48:38+00:00 2026-05-24T00:48:38+00:00

I want to simulate a block dialog like window.alert() , window.confirm() , or window.prompt()

  • 0

I want to simulate a block dialog like window.alert(), window.confirm(), or window.prompt() with DIV+JavaScript. It seems easy using a callback function. But I want to block the process while the confirm dialog is shown.

That is to say, I want to define a function like:

var Alert = function(){ balabala };

which returns true or false after I click OK or Cancel.

EDIT:

For now I defined a function called Confirm() and now I have to call it like

Confirm(*callback*);

and in the implementation I show a dialog like confirm and when OK is clicked the callback will be executed. I wonder whether it is possible to rewrite it so that I can call it like

if(Confirm()) {
    callback(); 
} else {
    balabala;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:48:39+00:00Added an answer on May 24, 2026 at 12:48 am

    You can’t block the user from using their browser IE switching tabs and doing other things on them before they come back to yours, like an alert() call does. But you can block them from using anything on your page until they answer the question. You can just fill the entire body with an absolute positioned div that has a z-index greater than the rest of your page, and give your popup a z-index one higher than that and center it.

    Of course a user can still use things like Chrome developer tools or Firebug to remove your blocking div, so it’s not a secure thing.

    Edit I misread your question. You don’t care about blocking the page visually but are wanting to make the popup’s return value synchronous with the rest of your script instead of asynchronous with a callback. I’m not sure how to go about that.

    Maybe this will be of use to you: https://developer.mozilla.org/en/Code_snippets/Threads#Waiting_for_a_background_task_to_complete

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to simulate ECG using javascript. i have done some part using JSXGraph
I want to Simulate a button click via JavaScript using a button's value, not
I want to simulate a microprocessor designed using VHDL in ModelSim. I wanted to
I've been using Git for a while. I want simulate a case in SVN
I want to simulate fire using SPH particles. I understand the concept behind SPH
I´m trying to simulate a table using only CSS and DIV. The problem is
I want to simulate N-sided biased die? def roll(N,bias): '''this function rolls N dimensional
I want to create a Java application bundle for Mac without using Mac. According
I want to simulate clicking with the mouse on all elements of a given
I want to simulate this error so I can check a generic error page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.