Results 1 to 2 of 2

Thread: JavaScript Pop Up Window Code?

  1. #1
    Join Date
    Feb 2018
    Thanked 0 Times in 0 Posts

    Default JavaScript Pop Up Window Code?

    What is the best and easiest way to have a modal window pop up in JavaScript code? I have a function in JavaScript where I would like to put a modal pop up window code in so what I know it is being hit. I did a search engine search on the internet for examples of this but everything I found was accompanied with HTML and CSS code. That is not what I am looking form. Please advise.

  2. #2
    Join Date
    Mar 2005
    Thanked 3,446 Times in 3,407 Posts
    Blog Entries


    This is almost too general of a question, and you will need some HTML and css to have a true modal popup. Perhaps you're talking about an alert or a confirm dialog. These are built in features of javascript and are very bare bones, but the user generally must dismiss them in order to continue. However, many browsers allow these to be disabled. But even a complex modal can be skipped if javascript is turned off or if the user uses the developer tools to delete it.

    The alert just gives information (configurable text) and the only option is to click OK to continue. Ex:

    alert('Hello World!');
    The confirm dialog gives an option to click OK or Cancel. Different things can then happen as a result of the choice made. The text shown to the user is configurable and should suggest the outcome of the choices presented. Ex:

    if(confirm('Do you want to continue?')){do something here to continue}else{do something else here to not continue}
    - John

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Replies: 1
    Last Post: 02-28-2014, 07:43 PM
  2. Replies: 0
    Last Post: 02-09-2010, 05:03 AM
  3. Replies: 2
    Last Post: 03-14-2009, 05:32 PM
  4. Replies: 2
    Last Post: 10-27-2008, 05:16 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts