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 6176903
In Process

The Archive Base Latest Questions

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

When I write alert(‘Hello’) , the page execution stops and waits for approval to

  • 0

When I write alert('Hello'), the page execution stops and waits for approval to continue.

I have a div setup to display as a fake alert, using HTML – this div has an ‘OK’ button.

I want the page to stop its execution (just like alert does) until the user click ‘OK’.

Is it possible ?

  • 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:10:56+00:00Added an answer on May 24, 2026 at 12:10 am

    You can’t. Only the special built-ins can do that. For a while there was the showModalDialog special built-in that let you specify a URI for the content and thus customize it, but it was never widely supported and is now deprecated even by browsers that once supported it.

    Instead, make your current alerting function that uses the div accept a callback for when the alert is closed (or return a promise that’s settled when it’s closed), to allow you to continue processing.

    So for instance, if your code used to use alert and work like this:

    function foo() {
        var x;
    
        x = doSomething();
        alert("Alert! Alert!");
        doSomethingAfterTheAlertIsCleared(x);
        doAnotherThingAfterward();
    }
    

    …you’d change it to:

    function foo() {
        var x;
    
        x = doSomething();
        fakeAlert("Alert! Alert!", function() {
            doSomethingAfterTheAlertIsCleared(x);
            doAnotherThingAfterward();
        });
    }
    

    Note that now all the code that followed the alert is in a function, whose reference we pass into the fakeAlert. The foo function returns while the fake alert is still showing, but eventually the user dismisses the fake alert and our callback gets called. Note that our callback code has access to the locals in the call to foo that we were processing, because our callback is a closure (don’t worry if that’s a fairly new and/or mysterious term, closures are not complicated).

    Of course, if the only thing following the alert is a single function call that doesn’t take any arguments, we could just pass that function reference directly. E.g., this:

    function foo() {
        doSomething();
        alert("Alert! Alert!");
        doSomethingAfterTheAlertIsCleared();
    }
    

    becomes:

    function foo() {
        doSomething();
        fakeAlert("Alert! Alert!", doSomethingAfterTheAlertIsCleared);
    }
    

    (Note that there are no () after doSomethingAfterTheAlertIsCleared — we’re referring to the function object, not calling the function; fakeAlert will call it.)

    In case you’re not sure how fakeAlert would call the callback, it would be within the event handler for the user “closing” the alert div, and you just call the argument for the callback just like you do with any other reference to a function. So if fakeAlert receives it as callback, you call it by saying callback();.

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

Sidebar

Related Questions

I have a div on page, which content will change by javascript, I want
I'm generating a JavaScript alert with following code in C# .NET page: Response.Write(<script language=JavaScript>
Response.Write(<script language='javascript'>alert(window.opener.location.pathname); if(window.opener.location.pathname.toString() == \/page.aspx\){window.opener.document.forms[0].submit();}</script>); This works in Chrome, but in IE I get
I have a JavaScript function, in this function i will write <script type='text/JavaScript' language='JavaScript'>alert('ha')</script>
When I run this simple greasemonkey script alert(hello); alert(document.location); document.write(hello); alert(hello); Only the first
This function should write the time spent on the page to the div. It
alert(hello); var d = Date(); //alert(d); var currHour = d.getHours(); document.write(currHour); function display1(currHour) {
Im using this code: $(this).css('backgroundcolor', localStorage.getItem('bgColorr') + !important;); When i write: alert( localStorage.getItem('bgColorr') +
Iam looking to write a C# application to alert the user when he gets
var doc = w.document; doc.open('application/CSV','replace'); doc.charset = utf-8; doc.write(all,hello); doc.close(); if(doc.execCommand(SaveAs,null,file.csv)) { window.alert(saved );

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.