<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <input type="button" id="dhk1" value="警告框">
    <input type="button" id="dhk2" value="对话框">
    <input type="button" id="dhk3" value="带确定警告框">

    <script>
var dhk1 = document.getElementById("dhk1");
var dhk2 = document.getElementById("dhk2");
var dhk3 = document.getElementById("dhk3");

//警告框
dhk1.onclick = function(){
    alert("hello");
};

//对话框
dhk2.onclick = function(){
    var num = prompt("请输入数字",12);
    console.log(num);
};


//让用户进行确认或取消选择
dhk3.onclick = function(){

  var fff =  confirm("确定还是取消?");

    console.log(fff);
};





    </script>
    
</body>
</html>