Home  >  Article  >  Web Front-end  >  Three kinds of message prompt windows in Js

Three kinds of message prompt windows in Js

一个新手
一个新手Original
2017-09-11 09:51:562367browse


JS three message prompt windows

1. Warning(alert)

<script type="text/JavaScript">
     alert("我是警告窗口");</script>

2.Confirm(confirm)

<script type="text/JavaScript">
     var res=confirm("确定?");     if (res==true)
     {
         document.write("操作成功");
     }     else
     {
         document.write("操作取消");
     } </script>

3.Information input (prompt)

<script type="text/JavaScript">function Grades() {
     var score;//分数
     var result;
     score = prompt("Your Grade ?")     if (score < 60){
         result= &#39;不及格!!&#39;;
     }else if (score >=85){
         result="优秀";
     }else
     {
         result="一般般";
     }
}</script>

The above is the detailed content of Three kinds of message prompt windows in Js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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