1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

今回はJSでのアラートボックスとダイアログボックスについて学習していきます!

アラートボックス▶ユーザーへの確認や注意喚起のために使われます。
ダイアログボックス▶ ユーザーへの確認と注意喚起のために使われるが、ボタンの情報を受け取ることができます。

index.js
<script>
    'use strict'

     alert('シャットダウンしますか??');

    const answer = confirm('削除しますか??');
    if (answer) {
      document.write('削除しました');
    } else {
      document.write('キャンセルしました');
    }

  </script>

ここで注意なのは、このダイアログボックスはCSSで装飾することができません。
あくまで、ユーザーに注意喚起をする目的になっていいます。

CSSでデザインする場合は
モーダルウィンドウを作ります。

次の記事でモーダルウィンドウを作って行きたいと思います👌

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?