Java Script

[JS] 팝업 #window.open

웨일파도 2023. 4. 12. 12:10
반응형
<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <title>공지사항</title>   
  <style>
    #content {
      border : 2px double skyblue;
      border-radius:10px;
      padding:10px;
    }
    ul {
      margin-left:15px;
      list-style-type:none;
    }
    ul li {margin : 10px 5px;}
    button{ 
      position:absolute;
      bottom:20px;
      right:20px;
    }
  </style>     
</head>
<body>
  <div id="content">
  <h1>공지사항</h1>
    <ul>
      <li>항목 1</li>
      <li>항목 2</li>
      <li>항목 3</li>
      <li>항목 4</li>
      <li>항목 5</li>
    </ul>    
    <button onclick='javascript:window.close()'>닫기</button>
  </div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    window.open("class4.html","팝업id","width=600, height=450");
</script>

팝업에 id 를 주면 중복적으로 팝업이 열리지 않음

반응형

'Java Script' 카테고리의 다른 글

[JS] eventListener  (0) 2023.04.12
[JS] 버튼클릭>함수호출>색 변경  (0) 2023.04.12
[JS] 초단위로 시간 변경 #setInterval  (0) 2023.04.12
[JS] 배열 함수  (0) 2023.04.11
[JS] 도서구매 개수 확인  (0) 2023.04.11