tinguo002

           

          iframe 刷新

          JS實現刷新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()">


            終極方案:當iframe的src為其它網站地址(跨域操作時)


          <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)">


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


          <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)>






          父頁面中存在兩個iframe,一個iframe中是一個鏈接列表,其中的鏈接指向另一個iframe,用于顯示內容。現在當內容內容添加后,在鏈接列表中添加了一條記錄,則需要刷新列表iframe。


          在內容iframe的提交js中使用parent.location.reload()將父頁面全部刷新,因為另一個iframe沒有默認的url,只能通過列表選擇,所以只顯示了列表iframe的內容。


          使用window.parent.frames["列表iframe名字"].location="列表url"即可進刷新列表iframe,而內容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"; //沒變化,沒動靜


          注意區別,document.all.refreshAlarm 或 document.frames("refreshAlarm")
          得到的是information.asp頁面中那個iframe標簽,所以對src屬性操作有用。
          document.frames("refreshAlarm").document得到iframe里面的內容,也就是"/public/alarmsum.asp"中的內容。


          這里需要補充說明的是:


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


          但是可以這樣


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


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



          自動刷新頁面



          javascript(js)自動刷新頁面的實現方法總結2008-04-18 13:24
          自動刷新頁面的實現方法總結:


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


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


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


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


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



          刷新頁面實現方式總結(HTML,ASP,JS)
          'by aloxy


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


          說明:url是要刷新的頁面URL地址
          2000是等待時間=2秒,


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


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


          3,<%response.redirect url%>


          說明:一般用一個url參數或者表單傳值判斷是否發生某個操作,然后利用response.redirect 刷新。


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


          彈出窗體后再刷新的問題



          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>");


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


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


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



          頁面定時刷新功能實現


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


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


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



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



          點擊按鈕提交表單后刷新上級窗口


          A窗口打開B窗口


          然后在B里面提交數據至C窗口


          最后要刷新A窗口


          并且關閉B窗口


          幾個javascript函數


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


          //第二個刷新父頁面的函數


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



          //第三個打開窗口


          <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>



          歡迎大家訪問我的個人網站 萌萌的IT人

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


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          收藏夾

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 宁德市| 蓝山县| 平山县| 泰和县| 铁岭县| 舟曲县| 唐河县| 合山市| 岚皋县| 涞水县| 利川市| 伊宁市| 乌兰浩特市| 建宁县| 宁阳县| 固始县| 瑞安市| 道真| 巴中市| 利津县| 延安市| 南阳市| 芷江| 宁德市| 嘉义县| 广水市| 娱乐| 确山县| 苗栗市| 定南县| 金川县| 报价| 古田县| 茂名市| 旬邑县| 玛沁县| 白河县| 靖边县| 遵义县| 邻水| 荆州市|