오픈
<!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>
<button id="pp" onclick="op()">팝업 오픈</button>
<script>
const op = ()=>{
window.open('test2.html','op','width=700,height=500,scrollbars=0,toolbar=0,menubar=no')
}
</script>
</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>
<h1>팝업!!!</h1>
<button id="pp" onclick="op()">팝업 닫기</button>
<script>
const op = ()=>{
self.close();
opener.location.href = 'https://www.naver.com'
}
</script>
</body>
</html>
'잡단한것들 > 코딩연습장' 카테고리의 다른 글
자바로 자료구조 구현하기 (0) | 2023.06.22 |
---|---|
검색 자동완성 구현 (1) | 2023.06.13 |
key이벤트 테스트 (0) | 2022.05.20 |
Vue2-datepicker 한글 커스텀하기 (0) | 2021.10.25 |
[JS] yyyy-mm-dd형태로 만들기 (Date객체 활용하기) (0) | 2021.10.19 |