tinguo002

           

          iframe 刷新

          JS實(shí)現(xiàn)刷新iframe的方法



          <iframe src="1.htm" name="ifrmname" id="ifrmid"></iframe>


          方案一:用iframe的name屬性定位


          <input type="button" name="Button"
          value="Button"
          onclick="document.frames('ifrmname').location.reload()">


            或


          <input type="button" name="Button"
          value="Button"
          onclick="document.all.ifrmname.document.location.reload()">


            方案二:用iframe的id屬性定位


          <input type="button" name="Button"
          value="Button"
          onclick="ifrmid.window.location.reload()">


            終極方案:當(dāng)iframe的src為其它網(wǎng)站地址(跨域操作時(shí))


          <input type="button" name="Button"
          value="Button"
          onclick="window.open(document.all.ifrmname.src,'ifrmname','')">





          代碼如下:<input type=button value=刷新 onclick="history.go(0)">


          代碼如下:<input type=button value=刷新 onclick="location.reload()">


          代碼如下:<input type=button value=刷新 onclick="location=location">


          代碼如下:<input type=button value=刷新
          onclick="window.navigate(location)">


          代碼如下:<input type=button value=刷新 onclick="location.replace(location)">


          下面這三種我就不知道該怎么用了,就把代碼放在下面吧,哪位要是會(huì)的話,可教教大家。


          <input type=button value=刷新
          onclick="document.execCommand(@#Refresh@#)">


          <input type=button value=刷新
          onclick="window.open(@#自身的文件@#,@#_self@#)">


          <input type=button value=刷新 onClick=document.all.WebBrowser.ExecWB(22,1)>






          父頁(yè)面中存在兩個(gè)iframe,一個(gè)iframe中是一個(gè)鏈接列表,其中的鏈接指向另一個(gè)iframe,用于顯示內(nèi)容。現(xiàn)在當(dāng)內(nèi)容內(nèi)容添加后,在鏈接列表中添加了一條記錄,則需要刷新列表iframe。


          在內(nèi)容iframe的提交js中使用parent.location.reload()將父頁(yè)面全部刷新,因?yàn)榱硪粋€(gè)iframe沒(méi)有默認(rèn)的url,只能通過(guò)列表選擇,所以只顯示了列表iframe的內(nèi)容。


          使用window.parent.frames["列表iframe名字"].location="列表url"即可進(jìn)刷新列表iframe,而內(nèi)容iframe在提交后自己的刷新將不受影響。








          document.frames("refreshAlarm").location.reload(true); //ok


          document.frames("refreshAlarm").document.location.reload(true); //ok


          document.frames("refreshAlarm").document.location="/public/alarmsum.asp";//ok


          document.getElementByIdx_x("refreshAlarm").src="/public/alarmsum.asp"
          mce_src="/public/alarmsum.asp"; //ok


          document.frames("refreshAlarm").src="/public/alarmsum.asp"
          mce_src="/public/alarmsum.asp"; //沒(méi)變化,沒(méi)動(dòng)靜


          注意區(qū)別,document.all.refreshAlarm 或 document.frames("refreshAlarm")
          得到的是information.asp頁(yè)面中那個(gè)iframe標(biāo)簽,所以對(duì)src屬性操作有用。
          document.frames("refreshAlarm").document得到iframe里面的內(nèi)容,也就是"/public/alarmsum.asp"中的內(nèi)容。


          這里需要補(bǔ)充說(shuō)明的是:


          采用document.getElementByIdx_x獲取后reload是不可以的


          但是可以這樣


          var myiframe = document.getElementByIdx_x("iframe1");


          myiframe.src = myiframe.src; //這樣同樣可以起到刷新的效果。



          自動(dòng)刷新頁(yè)面



          javascript(js)自動(dòng)刷新頁(yè)面的實(shí)現(xiàn)方法總結(jié)2008-04-18 13:24
          自動(dòng)刷新頁(yè)面的實(shí)現(xiàn)方法總結(jié):


          1)
          <meta
          http-equiv="refresh"content="10;url=跳轉(zhuǎn)的頁(yè)面">
          10表示間隔10秒刷新一次
          2)
          <script
          language=''javascript''>
          window.location.reload(true);
          </script>
          如果是你要刷新某一個(gè)iframe就把window給換成frame的名字或ID號(hào)
          3)
          <script
          language=''javascript''>
          window.navigate("本頁(yè)面url");
          </script>
          4>


          function
          abc()
          {
          window.location.href="/blog/window.location.href";
          setTimeout("abc()",10000);
          }


          刷新本頁(yè):
          Response.Write("<script
          language=javascript>window.location.href=window.location.href;</script>")


          刷新父頁(yè):
          Response.Write("<script
          language=javascript>opener.location.href=opener.location.href;</script>")


          轉(zhuǎn)到指定頁(yè):
          Response.Write("<script
          language=javascript>window.location.href='yourpage.aspx';</script>")



          刷新頁(yè)面實(shí)現(xiàn)方式總結(jié)(HTML,ASP,JS)
          'by aloxy


          定時(shí)刷新:
          1,<script>setTimeout("location.href='url'",2000)</script>


          說(shuō)明:url是要刷新的頁(yè)面URL地址
          2000是等待時(shí)間=2秒,


          2,<meta name="Refresh" content="n;url">


          說(shuō)明:
          n is the number of seconds to wait before loading the specified
          URL.
          url is an absolute URL to be
          loaded.
          n,是等待的時(shí)間,以秒為單位
          url是要刷新的頁(yè)面URL地址


          3,<%response.redirect url%>


          說(shuō)明:一般用一個(gè)url參數(shù)或者表單傳值判斷是否發(fā)生某個(gè)操作,然后利用response.redirect 刷新。


          4,刷新框架頁(yè)
             〈script
          language=javascript>top.leftFrm.location.reload();parent.frmTop.location.reload();</script〉


          彈出窗體后再刷新的問(wèn)題



          Response.Write("<script>window.showModalDialog('../OA/SPCL.aspx',window,'dialogHeight:
          300px; dialogWidth: 427px; dialogTop: 200px; dialogLeft:
          133px')</script>");//open
                      
          Response.Write("<script>document.location=document.location;</script>");


          在子窗體頁(yè)面代碼head中加入<base target="_self"/>


          刷新的內(nèi)容加在    if (!IsPostBack) 中


          在框架頁(yè)中右面刷新左面
              //刷新框架頁(yè)左半部分
              Response.Write("<script
          language=javascript>");
             
          Response.Write("parent.left.location.href='PayDetailManage_Left.aspx'");
             
          Response.Write("</script>");



          頁(yè)面定時(shí)刷新功能實(shí)現(xiàn)


          有三種方法:
          1,在html中設(shè)置:
          <title>xxxxx</title>之後加入下面這一行即可!
          定時(shí)刷新:<META
          HTTP-EQUIV="Refresh" content="10">
          10代表刷新間隔,單位為秒


          2.jsp
          <% response.setHeader("refresh","1"); %>
          每一秒刷新一次


          3.使用javascript:
          <script
          language="javascript">
          setTimeout("self.location.reload();",1000);
          <script>
          一秒一次



          頁(yè)面自動(dòng)跳轉(zhuǎn):
          1,在html中設(shè)置:
          <title>xxxxx</title>之後加入下面這一行即可!
          定時(shí)跳轉(zhuǎn)并刷新:<meta
          http-equiv="refresh"
          content="20;url=http://自己的URL">,
          其中20指隔20秒后跳轉(zhuǎn)到http://自己的URL 頁(yè)面。



          點(diǎn)擊按鈕提交表單后刷新上級(jí)窗口


          A窗口打開(kāi)B窗口


          然后在B里面提交數(shù)據(jù)至C窗口


          最后要刷新A窗口


          并且關(guān)閉B窗口


          幾個(gè)javascript函數(shù)


          //第一個(gè)自動(dòng)關(guān)閉窗口
          <script language="javascript">
          <!--
          function
          clock(){i=i-1
          document.title="本窗口將在"+i+"秒后自動(dòng)關(guān)閉!";
          if(i>0)setTimeout("clock();",1000);
          else
          self.close();}
          var i=2
          clock();
          //-->
          </script>


          //第二個(gè)刷新父頁(yè)面的函數(shù)


          <script
          language="javascript">
          opener.location.reload();
          </script>



          //第三個(gè)打開(kāi)窗口


          <script language="javascript">
          function
          show(mylink,mytitle,width,height)
          {mailwin=window.open(mylink,mytitle,'top=350,left=460,width='+width+',height='+height+',scrollbars=no')}
          </script>



          歡迎大家訪問(wèn)我的個(gè)人網(wǎng)站 萌萌的IT人

          posted on 2013-06-02 21:39 一堣而安 閱讀(645) 評(píng)論(0)  編輯  收藏


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(1)

          隨筆分類(lèi)

          隨筆檔案

          收藏夾

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 织金县| 出国| 安福县| 中西区| 仲巴县| 永福县| 富源县| 巍山| 林甸县| 启东市| 青冈县| 安新县| 平舆县| 仙桃市| 万盛区| 平远县| 德保县| 菏泽市| 德惠市| 普洱| 武胜县| 鹤岗市| 中西区| 广南县| 吉安县| 温泉县| 博爱县| 凤山市| 宁津县| 定边县| 阿拉善右旗| 通辽市| 贺州市| 彰化市| 龙江县| 虎林市| 兰西县| 宁晋县| 漳州市| 梅河口市| 黎川县|