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

Three kinds of message prompt windows in Js

一个新手
Release: 2017-09-11 09:51:56
Original
2373 people have browsed it


JS three message prompt windows

1. Warning(alert)

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

2.Confirm(confirm)

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

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>
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!