【 js 】 js 페이지 새로 고침
 
  
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  
  
 <HTML>  
  
 <HEAD>  
  
 <TITLE> frame </TITLE>  
  
 </HEAD>  
  
 <frameset rows="50%,50%">  
  
 <frame name=top src="top.html">  
  
 <frame name=bottom src="bottom.html">  
  
 </frameset>  
  
 </HTML>  
  
 
   현재 top. html (즉 위의 페이지) 에 7 개의 button 이 있다 고 가정 하면 bottom. html (즉 아래 페이지) 에 대한 새로 고침 을 실현 할 수 있 습 니 다. 다음 7 가지 문 구 를 사용 할 수 있 습 니 다. 어느 것 이 자신 이 알 아서 할 수 있 습 니까?
top. html 페이지 의 코드 는 다음 과 같 습 니 다.
 
  
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  
  
 <HTML>  
  
 <HEAD>  
  
 <TITLE> top.html </TITLE>  
  
 </HEAD>  
  
 <BODY>  
  
 <input type=button value="  1" onclick="window.parent.frames[1].location.reload()"><br>  
  
 <input type=button value="  2" onclick="window.parent.frames.bottom.location.reload()"><br>  
  
 <input type=button value="  3" onclick="window.parent.frames['bottom'].location.reload()"><br>  
  
 <input type=button value="  4" onclick="window.parent.frames.item(1).location.reload()"><br>  
  
 <input type=button value="  5" onclick="window.parent.frames.item('bottom').location.reload()"><br>  
  
 <input type=button value="  6" onclick="window.parent.bottom.location.reload()"><br>  
  
 <input type=button value="  7" onclick="window.parent['bottom'].location.reload()"><br>  
  
 </BODY>  
  
 </HTML>  
  
 
   다음은 bottom. html 페이지 소스 코드 입 니 다. 아래 페이지 가 새로 고침 되 었 음 을 증명 하기 위해 페이지 를 불 러 온 후 대화 상 자 를 팝 업 합 니 다.
 
  
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  
  
 <HTML>  
  
 <HEAD>  
  
 <TITLE> bottom.html </TITLE>  
  
 </HEAD>  
  
 <BODY onload="alert('     !')">  
  
 <h1>This is the content in bottom.html.</h1>  
  
 </BODY>  
  
 </HTML>  
  
 
   설명:
 
  
 1.window        ,          top.html  。  
  
 2.parent           ,           。          framedemo.html。  
  
 3.frames window  ,     。            。  
  
 4.item   。         。  
  
 5.            ,          ,             。  
  
  :  
  
 Javascript         :  
  
 1 history.go(0)  
  
 2 location.reload()  
  
 3 location=location  
  
 4 location.assign(location)  
  
 5 document.execCommand('Refresh')  
  
 6 window.navigate(location)  
  
 7 location.replace(location)  
  
 8 document.URL=location.href  
  
 
   2. 페이지 자동 새로 고침
1. 페이지 자동 새로 고침: 다음 코드 를 < head > 영역 에 추가 합 니 다.
그 중 20 손가락 은 20 초 마다 페이지 를 새로 고침 합 니 다.
2. 페이지 자동 이동: 다음 코드 를 < head > 영역 에 추가 합 니 다.
그 중 에 20 손가락 이 20 초 만 에 돌 아 옵 니 다.http://www.jb51.net페이지
3. 페이지 자동 새로 고침 js 버 전
[Ctrl + A 전체 주석: 외부 Js 를 도입 하려 면 새로 고침 이 필요 합 니 다.]
3. 자바 가 Servler, Action 등 프로그램 을 쓸 때 페이지 로 돌아 가 는 작업 을 하려 면 (예 를 들 어 창 이 나 왔 습 니 다. 작업 이 끝 난 후에 현재 페이지 를 닫 고 부모 페이지 를 새로 고 칩 니 다)
 
  
 1 PrintWriter out = response.getWriter();  
  
 2 out.write("<script type=\"text/javascript\">");  
  
 3 ////          
  
 4 out.write("self.opener.location.reload();");  
  
 5 //      
  
 6 out.write("window.opener=null;");  
  
 7 out.write("window.close();");  
  
 8 out.write("</script>");  
  
 
   4. JS 프레임 새로 고침 스 크 립 트 문구
1. 이 프레임 을 포함 하 는 페이지 를 새로 고 치 는 방법
 
  
 <script language=JavaScript>  
  
 parent.location.reload();  
  
 </script>  
  
 
   2. 하위 창 부모 창 새로 고침
 
  
 <script language=JavaScript>  
  
 self.opener.location.reload();  
  
 </script>  
  
 
   3. 다른 프레임 의 페이지 를 새로 고 치 는 방법 (위의 인 스 턴 스 는 설명 합 니 다)
 
  
   1. window.parent.frames[1].location.reload();  
  
   2. window.parent.frames.bottom.location.reload();  
  
   3. window.parent.frames["bottom"].location.reload();  
  
   4. window.parent.frames.item(1).location.reload();  
  
   5. window.parent.frames.item('bottom').location.reload();  
  
   6. window.parent.bottom.location.reload();  
  
   7. window.parent['bottom'].location.reload();  
  
 
   4. 창 을 닫 을 때 새로 고침 하거나 열 려 고 할 때 새로 고침 하려 면 < body > 에서 다음 문 구 를 호출 하면 됩 니 다.
창 을 열 때 새로 고침
닫 을 때 새로 고침
 
  
 <script language="javascript">  
  
 window.opener.document.location.reload()  
  
 </script>  
 
                이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.