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

본문 바로가기

script

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

작성일 06-09-12 12:57

페이지 정보

작성자서방님 조회 531회 댓글 0건

본문

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

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

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

// 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();
}

댓글목록

등록된 댓글이 없습니다.

게시물 검색
Copyright © 서방님.kr All rights reserved.
PC 버전으로 보기