Popups in JavaScript

Good for getting input

 

alert()

Pops up an "alert" window

User just can close it

We could use w3schools too, e.g. here

Replace

     document.getElementById('demo').innerHTML = Date()"

with

     "alert();"

Let's analyze the code...

Let's try it, too...

Doesn't work?

Maybe your browser settings disallow popups

(See below)

 

 

 

confirm()

Pops up a "confirm" window

User has 2 choices (confirm or not)

We could use w3schools too, e.g. here

Doesn't work?

Maybe your browser settings disallow popups

(See below)

 

 

prompt()

Pops up a "prompt" window

User has more choices

Can input a string

We could use w3schools too, e.g. here

Maybe your browser settings disallow popups

(See below)

 

 

If your browser disallows popups

Change the settings to allow them

Sometimes you can click a small icon to allow it to pop up

Do a web search like

chrome popups settings

or

chrome allowing popups

or

(some other query)

Try a different browser