JavaScript

[Window_Object] JS - window.frames 속성 - 프레임 윈도우객체속성 (= window.frames속성 = 윈도우프레임즈 속성)

목차
  1. window.frames 예제 - <iframe> 요소 접근
  2. window.frames 정의
  3. window.frames 구문
  4. window.frames 예제 - <iframe> 주소 일괄 변경

 

window.frames 예제 - <iframe> 요소 접근

 

<button onclick="hz()">클릭</button>

<br>

<iframe src="https://homzzang.com/html"></iframe>

<iframe src="https://homzzang.com/css"></iframe>


<script>

function hz() {

  window.frames[0].location = "https://homzzang.com/";

}

</script>

 

※ 첫 번째 iframe 주소를 homzzang.com으로 변경

 

window.frames 정의

 

현재 윈도우의 모든 <iframe> 요소를 나타내는 배열 모양의 객체 반환.

 



1.

<iframe> 요소는 0부터 시작하는 인덱스 번호로 접근 가능.


2.

프레임 개수 : frames.length


3.

<frame> 요소에도 적용. 

cf. HTML5 경우, <frame> 요소 지원 중단.


4.

읽기 전용.


5.

모든 브라우저가 지원.

 

 

window.frames 구문

 

window.frames

 

 

ps. 각 iframe은 [index] 이용해 접근. (예) window.frames[0]

 

window.frames 예제 - <iframe> 주소 일괄 변경

 

<button onclick="homzzang()">클릭</button>

<br><br>


<iframe src="https://google.com"></iframe>

<iframe src="https://daum.com"></iframe>

<iframe src="https://naver.com"></iframe>


<script>

function homzzang() {

  var po = window.frames;

  var i;


  for (i = 0; i < po.length; i++) {

    po[i].location = "https://homzzang.com";

  }

}

</script>


※ 모든 iframe 주소를 homzzang.com으로 변경.


 


분류 제목
DOM_Event JS - screenX -
DOM_Event JS - screenY -
DOM_Event JS - shiftKey 속성 - Shift키 눌림여부반환 (= 시프트키코드)
DOM_Event JS - state -
DOM_Event JS - stopImmediatePropagation() 메서드 -
DOM_Event JS - stopPropagation() 메서드 ★ - 이벤트확산방지 (= 이벤트전파방지 = stopProp…
DOM_Event JS - storageArea -
DOM_Event JS - target 속성 ★ -
DOM_Event JS - targetTouches -
DOM_Event JS - timeStamp -
DOM_Event JS - total -
DOM_Event JS - touches -
DOM_Event JS - transitionend -
DOM_Event JS - type -
DOM_Event JS - url -
51/89
목록
 홈  PC버전 로그인 일본어
그누앞단언어
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티 2
웹유틸
회원센터
홈짱닷컴 PC버전 로그인