zoukankan      html  css  js  c++  java
  • JavaScript 三个常用对话框

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    
    <body>
    <p id="y">JavaScript JavaScript</p>
    <script>
    
    alert("更改内容不可更改")<!--警告对话框-->
    
    function my()
    {
        x=document.getElementById("y")
        
        if(confirm("确定要替换么?"))<!--confirm确定对话框,点击确定返回true,点击取消返回false-->
    
        x.innerHTML=prompt("请输入替换的内容","好好想想要写啥")
        <!--x.innerHTML可以直接加双引号赋值,prompt作用是弹出一个可以输入内容的对话框-->
        }
        
    </script>
    <input type="button" value="点击替换" onclick="my()" />
    </body>
    </html>
    View Code

  • 相关阅读:
    Freefilesync-文件夹自动同步
    考研打卡_Day077
    考研打卡_Day076
    考研打卡_Day075
    考研打卡_Day074
    考研打卡_Day073
    考研打卡_Day072
    考研打卡_Day071
    考研打卡_Day070
    考研打卡_Day069
  • 原文地址:https://www.cnblogs.com/wangchuanqi/p/5319287.html
Copyright © 2011-2022 走看看