1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I code a pop-up window in JavaScript?

Discussion in 'JavaScript' started by xarzu, Feb 21, 2018.

  1. #1
    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.
     
    xarzu, Feb 21, 2018 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    if you need anything fancier than this then you'll need html.

    <!DOCTYPE html>
    <html>
    <body>
    
    <p>Click the button to display a confirm box.</p>
    
    <button onclick="myFunction()">Try it</button>
    
    <script>
    function myFunction() {
        confirm("Press a button!");
    }
    </script>
    
    </body>
    </html>
    Code (markup):
     
    sarahk, Feb 21, 2018 IP
    deathshadow likes this.