[JS]ポップアップウィンドウの作成


💡 Java Scriptを使用したポップアップウィンドウの作成



多くのWebサイトで見られるシェイプのポップアップウィンドウを作成します!

🔴 メインHTML、CSS

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

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>메인페이지</title>
  <style type="text/css">
    body {
      background:beige;
    }
  </style>
</head>

<body>
  <button type="button">
    팝업 1
  </button>
  <button type="button">
    팝업 2
  </button>
</body>

</html>

🟠 ポップアップ1 HTML、CSS

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

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>팝업 1</title>
  <style type="text/css">
    body {
      background: #ff66ff;
      font-size: 24px;
      color: #fff;
    }
  </style>
</head>

<body>
  첫 번째 팝업입니다.
  <a href>[닫기]</a>
</body>

</html>

🟡 ポップアップ2 HTML、CSS

<!DOCTYPE html>
<html lang="ko">
  
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>팝업 2</title>
  <style type="text/css">
    body {
      background: rgb(56, 255, 132); 
      font-size: 24px; 
      color: #fff;
    }
  </style>
</head>
  
<body>
  두 번째 팝업입니다.
  <a href>[닫기]</a>
</body>
  
</html>

🟢 JSの設定


(スクリプト位置を