zoukankan      html  css  js  c++  java
  • confirg

     如果用户点击确定按钮,则 confirm() 返回 true。如果点击取消按钮,则 confirm() 返回 false。
    在用户点击确定按钮或取消按钮把对话框关闭之前,它将阻止用户对浏览器的所有输入。在调用 confirm() 时,将暂停对 JavaScript 代码的执行,在用户作出响应之前,不会执行下一条语句。
    下面我们通过这两个小例子,来了解一下它的使用方法吧:
    复制代码 代码如下:

    <html>
    <head>
    <title>confrim 的使用方法</title>
    <script type="text/javascript">
    function clear1()
    {
     if(confirm("确定要清空数据吗?"))
     {
     document.main.text1.value="";
     }
    }
    </script>
    </head>
    <boty>
    <form name="main">
    <input type="text" name="text1"/>
    <input type="button" name="submit" value="数据清空" onclick="return clear1()"/>
    </form>
    </body>
    <ml>
    <html>
    <head>
    <title>js confirm</title>
    <script>
    function begin()
    {
     var a=confirm("郭杨和小代是好朋友吗?");
     if(a==true)
     {
     /*document.write("恭喜你答对了!");*/
     alert("恭喜你答对了!");
     begin();
     }
     else
     {
     /*document.write("你真是猪,这么简单的问题都答不对!");*/
     alert("你真是猪,这么简单的问题都答不对!");
     begin();
     }
     }
    </script>
    </head >
    <body onload="begin()">
    </body>
    <ml>
  • 相关阅读:
    虚拟机vmware的连接方式以及IP端口,协议等概念
    python3爬虫--shell命令的使用和firefox firebug获取目标信息的xpath
    numpy的基本用法
    scrapy模拟请求头
    (1)python Scrapy爬虫框架
    flutter ui
    dart 类
    dart 基础
    黑苹果镜像下载地址
    android9.0请求异常
  • 原文地址:https://www.cnblogs.com/kongxc/p/7110530.html
Copyright © 2011-2022 走看看