Notice
Recent Posts
Recent Comments
Link
«   2024/06   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

chapter01 : window객체 본문

WEB.JS/07.BOM_JS

chapter01 : window객체

GAWON 2023. 5. 22. 09:16
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
/*
BOM : Browser Object Model(브라우저 객체 모델)

```
	1.window 객체
	  1)브라우저 내장 객체 중에서 최상위 객체
	  2)모든 전역, 함수, 변수 들은 자동적으로 window 객체에 속함
	  3)window.함수(),window.변수 등과 같은 형태로 사용이 가능
	  4)window 객체를 생략한 형태로 사용이 가능
	    window.alert() -> alert()

	2.window 객체 생성
	  1)open("URL" , "name", "feature");
	    -URL : 주소 ,파일의 경로
	    -name : <a> 태그의 target 으로 사용 가능
	    -feature : 크기 ,위치 등
	3.window 객체 소멸
	  1)close()

*/

//1. window 프로퍼티 확인
for(var p in window){
	document.write("<h1>" + p + " : " + window[p] + "</h1>" );
}

//2. 새 창 만들기
var newWin = window.open("","", "width=400 , height=300");
//너비와 높이는 px 단위, 단위는 붙지 않는다.

if(newWin){
	newWin.document.write("<h1>팝업 창 내용</h1>");
}else{
	alert("팝업 차단을 해제하세요.")
}

```

</script>
</head>
<body>

</body>
</html>

'WEB.JS > 07.BOM_JS' 카테고리의 다른 글

chapter05 : location  (0) 2023.05.22
chapter04 : history  (0) 2023.05.22
chapter03 : window객체  (0) 2023.05.22
chapter02 : window객체  (0) 2023.05.22