F5키로 포커스가 있는 프레임만 리프레쉬 > script

본문 바로가기
사이트 내 전체검색

script

F5키로 포커스가 있는 프레임만 리프레쉬

페이지 정보

작성자 서방님 댓글 0건 조회 206회 작성일 06-09-12 12:57

본문

네이버에서 훔쳐왔습니다.

그런데 불여우에서는 아직 잘 안먹습니다.. ㅠ.ㅠ

이것을 아이프레임에 삽입되는 화일에 넣어주면 됩니다.

// F5를 눌렀을때 iframe 내부만 refresh 되도록 처리 start
if (document.all) {
    document.onkeydown = trapRefreshIE;
} else {
    document.captureEvents(Event.KEYDOWN)
    document.onkeydown = trapRefreshNS;
}

function trapRefreshNS(e){
if (e.keyCode == 116){
e.cancelBubble = true;
e.returnValue = false;
document.location.reload();
}
}

function trapRefreshIE(){
if (event.keyCode == 116){
event.keyCode = 0;
event.cancelBubble = true;
event.returnValue = false;
document.location.reload();
}
}
// F5를 눌렀을때 iframe 내부만 refresh 되도록 처리 end

 


댓글 :

ie fierfox 상관없이 함수 인자에 event 로 넘겨받으면 됩니다.

function trapRefresh(event){
if (event.keyCode == 116){
event.keyCode = 0;
event.cancelBubble = true;
event.returnValue = false;
document.location.reload();
}

댓글목록

등록된 댓글이 없습니다.

Total 846건 56 페이지
게시물 검색

회원로그인

접속자집계

오늘
119
어제
225
최대
1,347
전체
154,878
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.