Home > Web Front-end > JS Tutorial > body text

What are the commonly used message boxes in JS?

php中世界最好的语言
Release: 2018-03-17 14:33:22
Original
1297 people have browsed it

This time I will bring you the message boxes commonly used in JS, and the notes of commonly used message boxes in JS. The following is a practical case, let’s take a look.

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>
Copy after login
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to dynamically create tags and set attributes with js

Use JS to do calculations

The above is the detailed content of What are the commonly used message boxes in JS?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template