日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
JavaScript刷新框架及頁(yè)面的方法總集

聲明:

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

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

先來(lái)看一個(gè)簡(jiǎn)單的例子

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

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

 
 
 
  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 (即上面的頁(yè)面) 有七個(gè)button來(lái)實(shí)現(xiàn)對(duì)bottom.html (即下面的頁(yè)面) 的刷新,可以用以下七種語(yǔ)句,哪個(gè)好用自己看著辦了。

語(yǔ)句1. window.parent.frames[1].location.reload();

語(yǔ)句2. window.parent.frames.bottom.location.reload();

語(yǔ)句3. window.parent.frames["bottom"].location.reload();

語(yǔ)句4. window.parent.frames.item(1).location.reload();

語(yǔ)句5. window.parent.frames.item('bottom').location.reload();

語(yǔ)句6. window.parent.bottom.location.reload();

語(yǔ)句7. window.parent['bottom'].location.reload();

top.html 頁(yè)面的代碼如下:

 
 
 
  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頁(yè)面源代碼,為了證明下方頁(yè)面的確被刷新了,在裝載完頁(yè)面彈出一個(gè)對(duì)話框。

bottom.html 頁(yè)面的代碼如下:

 
 
 
  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)前頁(yè)面,例如對(duì)于此例它指的是top.html頁(yè)面。

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

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

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

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

附:

Javascript刷新頁(yè)面的幾種方法: 

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 

自動(dòng)刷新頁(yè)面的方法:

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

 
 
 
  1.      

其中20指每隔20秒刷新一次頁(yè)面.

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

 
 
 
  1.      

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

3.頁(yè)面自動(dòng)刷新js版

 
 
 
  1.   

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

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

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

3.  Response.Write("")

JS刷新框架的腳本語(yǔ)句

 
 
 
  1. //如何刷新包含該框架的頁(yè)面用     
  2.      
  3. //子窗口刷新父窗口  
  4.    
  5. ( 或  刷新    )  
  6.  
  7. //如何刷新另一個(gè)框架的頁(yè)面用     
  8.    

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

 
 
 
  1.  開窗時(shí)刷新   
  2.  關(guān)閉時(shí)刷新   
  3.  

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

【編輯推薦】

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

當(dāng)前題目:JavaScript刷新框架及頁(yè)面的方法總集
文章網(wǎng)址:http://m.5511xx.com/article/djjhdjo.html