window的三種系統彈框介紹


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        /* 001-彈出對話框,作用是提示用戶 alert() */
        // alert(123);

        /* 002-彈出對話框,擁有取消和確定兩個按鈕,confirm()   */
        // var flag = confirm("確定要刪除核按鈕的密碼嗎?");
        /* 如果點擊的是確定,返回true 取消那么返回的是false */
        // console.log(flag);

        /* 003 彈出輸入框,標題 && 輸入框 && 取消 && 確定*/
        // var res = prompt("請輸入您的昵稱?");
        var res = window.prompt("請輸入您的昵稱?", "小妖怪");
        /* 確定:輸入框的內容 */
        /* 取消:null */
        console.log(res);
        /* 上面的這三個方法都是window的方法 */
        console.log(window.prompt == prompt, alert == window.alert); /* true trues */
    </script>
</body>

</html>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM