Jam's story

[JS] 새창 열고 닫기 본문

WEB/JavaScript

[JS] 새창 열고 닫기

애플쩀 2022. 6. 9. 16:32
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>2022.06.09 16:27:55</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<h3>ex07_03.html</h3>
<button onclick="windowOpen()">새창열기</button>
<button onclick="windowClose()">새창닫기</button>
<script>
    var newWin;
    function windowOpen(){
        //열고자하는 창의 주소, 두번째값은 생략가능, 3번째 값은 위치랑 넓이
        newWin=window.open("ex07_03.html","","width=600, heigh=500, top=100, left=200");
    }
    function windowClose(){
        newWin.close();
    }
</script>
</body>
</html>

 

'WEB > JavaScript' 카테고리의 다른 글

[JS] oncontextmenu (오른쪽마우스) ,onmousedown  (0) 2022.06.10
[JS]window.alert()  (0) 2022.06.10
[JS] 드래그  (0) 2022.06.09
[JS] 클로저  (0) 2022.06.09
[JS] function (함수) 정리  (0) 2022.06.09
Comments