Browser Object Model |- BOM, in JavaScript
Method | Description |
---|---|
alert() | displays the alert box containing message with ok button. |
confirm() | displays the confirm dialog box containing message with ok and cancel button. |
prompt() | displays a dialog box to get input from the user. |
open() | opens the new window. |
close() | closes the current window. |
setTimeout() | performs action after specified time like calling function, evaluating expressions etc. |
alert()
confirm() in javascript
It displays the confirm dialog box. It has message with ok and cancel buttons.
prompt() in javascript
It displays prompt dialog box for input. It has message and text field.
open() in javascript
It displays the content in a new window.
setTimeout() in javascript
Definition and Usage
The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds.
Tip: 1000 ms = 1 second.
Tip: The function is only executed once. If you need to repeat execution, use the setInterval() method.
Tip: Use the clearTimeout() method to prevent the function from running.
Example
Display an alert box after 2 seconds (2000 milliseconds):
It performs its task after the given milliseconds.