zoukankan      html  css  js  c++  java
  • JavaScript学习 常用的对话框函数

    JavaScript提供了三个很不错的对话框函数,使用这三个函数可以很方便的显示一个对话框;

      一、alert();   

    <script type="text/javascript">
        alert("你好,"+'
    '+"这是第二行内容");
    </script>


      二、prompt();

         

    <script type="text/javascript">
        function disp_prompt(){
                var name=  prompt("Please enter you name","Aqua");
                
                if(name!=null && name!=""){
                        document.write("Hello "+name+" !How are you today?");
                    }
            }
    
    </script>
    
    <input type="button"  onclick="disp_prompt()" value="单击来看看有什么"  />


       三、confirm()

      

    <script type= "text/javascript">
        function disp_confirm(){
                var r = confirm("Press a Button");
                if(r == true){
                            document.write("You Processed OK");
                        }else{
                                document.write("You Process Cancel");
                            }
            }
    </script>
    <input type="button" onclick="disp_confirm()" value ="显示窗口来看看" />

  • 相关阅读:
    Android Studio不自动代码提示问题解决
    公司邮箱
    IntentService2
    python帮助信息和常见强制转换
    列表,字典的常用方法
    python的类型(一)
    python运算符
    pycharm调试技巧
    python开发工具
    python安装
  • 原文地址:https://www.cnblogs.com/flay/p/3548333.html
Copyright © 2011-2022 走看看