테스트 사이트 - 개발 중인 베타 버전입니다

타겟(target) 쓰는 법 입니다.

· 9년 전 · 306

프레임을 쓰실때 생각할 것 세가지
1. frame_name.location = 'url.php';
또는 frame_name.location.href = 'url.php';
또는 frame_name.location.replace('url.php')
2. parent.frame_name.location = 'url.php';
3. opener.parent.frame_name.location = 'url.php';

새창을 열게해준 창의 주소를 바꾸고 새창을 끈다.
<script>
opener.location.href = 'url.php';
self.close();
</script>

새창을 열게해준 창의 주소를 새로고침하고 새창을 끈다
<script>
opener.location.reload();
self.close();
</script>

다른 프래임의 주소를 바꾸게 하려면
<script>
frame_name.location.href = 'url.php';
</script>

프래임 구조상 상위 프래임의 주소를 바꾸게 하려면
<script>
parent.location.href = 'url.php';
</script>

타겟이 지정된 프레임을 바꾼다.(타겟하나)
<script>
parent.target(타겟).location.href = 'url.php';
</script>

타겟이 지정된 프레임을 바꾼다.(타겟둘)
<script>
parent.target1(타겟1).location.href = 'url1.php';
parent.target2(타겟2).location.href = 'url2.php';
</script>

타겟이 지정된 프레임을 바꾼다.(타겟셋)
<script>
parent.target1(타겟1).location.href = 'url1.php';
parent.target2(타겟2).location.href = 'url2.php';
parent.target3(타겟3).location.href = 'url3.php';
</script>

타겟이 지정된 프레임두개를 클릭으로 바꾸려면
<script>
function target_frame(url1, url2)
{
parent.top_frame.location.href = url1;
parent.main_frame.location.href = url2;
}
</script>
<a href="javascript:target_frame('main_menu.html', '$go_url');"> 확인 </a>

로그인페이지 에선
<script>
parent.top_frame.location.href = '../main.html'; //main.html는 로그인페이지 보다 상위디렉토리에 있다.
 parent.main_frame.location.href = '$go_url';
</script>

로그인페이지를 새창으로 띄웠다면
<script>
opener.parent.top_frame.location.href = '../main.html';
opener.parent.main_frame.location.href = '$go_url';
self.close();
</script>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

게시글 목록

번호 제목
8050
8048
19969
19968
19967
19966
19965
19964
19963
19962
19961
28345
31017
19960
19959
19958
19957
8039
8035
8029
28344
28339
8019
28338
8017
8010
8007
8004
8003
28332
28322
7999
28317
20956
7992
20945
28314
20936
20931
7986
20925
7982
7979
7978
7975
28307
7973
7966
28305
7963
28300
7961
28297
28295
7959
19948
19947
28292
31016
19946
19945
28286
7958
7956
7952
7946
28285
28283
19943
7944
7936
7931
28279
24666
24663
7928
7923
19941
28274
28257
28249
28248
7914
7912
7911
20912
7908
31755
28233
28232
28228
7903
28217
20900
24662
20891
20882
19936
20853
31011