av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

JavaScript刷新框架及頁面的方法總集

聲明:

成都創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比五通橋網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式五通橋網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋五通橋地區(qū)。費(fèi)用合理售后完善,十余年實(shí)體公司更值得信賴。

最近越來越感覺JS的優(yōu)越性,項(xiàng)目中用到關(guān)于框架頁面刷新的方法,在網(wǎng)上搜索以后發(fā)現(xiàn)有許多不錯(cuò)的代碼,但不是很齊全。于是,我索性從網(wǎng)絡(luò)上搜集以后經(jīng)過精心編排,整理了一下。^ - ^ 希望大家多多指教!

先來看一個(gè)簡單的例子

下面以三個(gè)頁面分別命名為frame.html、top.html、bottom.html為例來具體說明如何做。 

frame.html 由上(top.html)下(bottom.html)兩個(gè)頁面組成,代碼如下:

 
 
 
  1.    
  2.  < HTML >   
  3.  < HEAD >   
  4.  < TITLE >  frame     
  5.      
  6.  < frameset  rows ="50%,50%" >   
  7.  < frame  name =top  src ="top.html" >   
  8.  < frame  name =bottom  src ="bottom.html" >   
  9.     
  10.    

現(xiàn)在假設(shè)top.html (即上面的頁面) 有七個(gè)button來實(shí)現(xiàn)對bottom.html (即下面的頁面) 的刷新,可以用以下七種語句,哪個(gè)好用自己看著辦了。

語句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();

top.html 頁面的代碼如下:

 
 
 
  1.    
  2.  < HTML >   
  3.    < HEAD >   
  4.     < TITLE >  top.html     
  5.       
  6.  < BODY >   
  7.  < input  type =button  value ="刷新1"  onclick ="window.parent.frames[1].location.reload()" >< br >   
  8.  < input  type =button  value ="刷新2"  onclick ="window.parent.frames.bottom.location.reload()" >< br >   
  9.  < input  type =button  value ="刷新3"  onclick ="window.parent.frames['bottom'].location.reload()" >< br >   
  10.  < input  type =button  value ="刷新4"  onclick ="window.parent.frames.item(1).location.reload()" >< br >   
  11.  < input  type =button  value ="刷新5"  onclick ="window.parent.frames.item('bottom').location.reload()" >< br >   
  12.  < input  type =button  value ="刷新6"  onclick ="window.parent.bottom.location.reload()" >< br >   
  13.  < input  type =button  value ="刷新7"  onclick ="window.parent['bottom'].location.reload()" >< br >   
  14.     
  15.   

下面是bottom.html頁面源代碼,為了證明下方頁面的確被刷新了,在裝載完頁面彈出一個(gè)對話框。

bottom.html 頁面的代碼如下:

 
 
 
  1.    
  2.  < HTML >   
  3.    < HEAD >   
  4.     < TITLE >  bottom.html     
  5.       
  6.  < BODY  onload ="alert('我被加載了!')" >   
  7.  < h1 > This is the content in bottom.html.    
  8.     
  9.   

解釋一下:

1.window指代的是當(dāng)前頁面,例如對于此例它指的是top.html頁面。

2.parent指的是當(dāng)前頁面的父頁面,也就是包含它的框架頁面。例如對于此例它指的是framedemo.html。

3.frames是window對象,是一個(gè)數(shù)組。代表著該框架內(nèi)所有子頁面。

4.item是方法。返回?cái)?shù)組里面的元素。

5.如果子頁面也是個(gè)框架頁面,里面還是其它的子頁面,那么上面的有些方法可能不行。

附:

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 

自動刷新頁面的方法:

1.頁面自動刷新:把如下代碼加入區(qū)域中

 
 
 
  1.      

其中20指每隔20秒刷新一次頁面.

2.頁面自動跳轉(zhuǎn):把如下代碼加入區(qū)域中

 
 
 
  1.      

其中20指隔20秒后跳轉(zhuǎn)到http://www.wyxg.com頁面

3.頁面自動刷新js版

 
 
 
  1.  
  2.  function myrefresh()  
  3.  {  
  4.       window.location.reload();  
  5.  }  
  6.  setTimeout('myrefresh()',1000); //指定1秒刷新一次  
  7.   

ASP.NET如何輸出刷新父窗口腳本語句

1.  this.response.write(""); 

2.  this.response.write("");  

3.  Response.Write("")

JS刷新框架的腳本語句

 
 
 
  1. //如何刷新包含該框架的頁面用     
  2.  
  3.   parent.location.reload();  
  4.      
  5. //子窗口刷新父窗口  
  6.  
  7.    self.opener.location.reload();  
  8.    
  9. ( 或  刷新    )  
  10.  
  11. //如何刷新另一個(gè)框架的頁面用     
  12.  
  13.   parent.另一FrameID.location.reload();  
  14.    

如果想關(guān)閉窗口時(shí)刷新或者想開窗時(shí)刷新的話,在 中調(diào)用以下語句即可。 

 
 
 
  1.  開窗時(shí)刷新   
  2.  關(guān)閉時(shí)刷新   
  3.  
  4. window.opener.document.location.reload()  
  5.  

原文鏈接:http://web001.iteye.com/blog/1631060

【編輯推薦】

  1. JavaScript實(shí)現(xiàn)HTML5重要語言
  2. JavaScript,只有你想不到
  3. JavaScript面試后的反思
  4. JavaScript制作新浪網(wǎng)易的評論塊
  5. JavaScript 鉤子機(jī)制

本文名稱:JavaScript刷新框架及頁面的方法總集
地址分享:http://uogjgqi.cn/article/djjhdjo.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們在微信上24小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流