JavaScript popup

You can create three kinds of message boxes in JavaScript: warning box, confirmation box, and prompt box.

JavaScript alert()

Syntax:alert("sometext");

at Use the alert command in JavaScript to create a message warning box:

JavaScript confirm()

Use the confirm command in JavaScript to create a message confirmation box:

Syntax:confirm("sometext");

The confirmation box is usually used to verify whether the user operation is accepted.

When the confirmation card pops up, the user can click "Confirm" or "Cancel" to confirm the user operation.

When you click "Confirm", the confirmation box returns true. If you click "Cancel", the confirmation box returns false.

    php中文网(php.cn)  

JavaScript prompt()

Syntax:prompt("sometext","defaultvalue");


Syntax description

prompt() allows two parameters: the first parameter is the prompt text to be displayed, and the second parameter is the default input character. If the input box is not empty, prompt() returns the value of the input box (HTML format is supported), otherwise it returns null.

    php中文网(php.cn)  

Line break

The pop-up window uses backslash + "n"(\n) to set line break.

    php中文网(php.cn) 


Continuing Learning
||
php中文网(php.cn)

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!