WEB.JS/07.BOM_JS

chapter02 : window객체

GAWON 2023. 5. 22. 09:16
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
//1. 전역 객체 선언
var newWin;

```
//2.창 열기
function winOpen() {
	var feature = "width=400, height=300, top=100, left=100,";
	feature += "menuber=yes, location=yes , scrollbars=yes, status=yes, resizable=yes";

	newWin = window.open("index.html", "" ,feature);
}

//3.창 닫기
function winClose() {
	newWin.close();
}

```

</script>
</head>
<body>
<button onclick="winOpen()">창 열기</button>
<button onclick="winClose()">창 닫기</button>
</body>
</html>