Home >Web Front-end >JS Tutorial >How to implement commonly used message boxes in JS?
I have summarized the most commonly used message prompt boxes in JS for everyone. You should use them frequently, so let’s learn them together.
First let’s take a look at the running effect
##Add it to share it all Code:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript"> function warn_info(){ alert("提示消息框"); } function sure_info(){ if (confirm("确认删除吗?")){ alert("删除成功"); } else{ alert("取消删除"); } } function input_info(){ var txt=prompt("请输入您的年龄"); if(txt==""){ alert("输入为空,重新输入"); } else{ alert("您的年龄为"+txt) } } </script> </head> <body> <input type="button" value="提示消息" onclick="warn_info()"> <input type="button" value="确认消息" onclick="sure_info()"> <input type="button" value="输入消息" onclick="input_info()"> </body> </html>The above is what I compiled for everyone. I hope it will be helpful to everyone in the future. Related articles:
How to use ngrok express to solve WeChat interface debugging problems
How to use element-ui tables to make cells editable
How to clear the verification after closing the dialog in element ui
The above is the detailed content of How to implement commonly used message boxes in JS?. For more information, please follow other related articles on the PHP Chinese website!