zoukankan      html  css  js  c++  java
  • How to (how to refresh/redirect the contents of one frame from another frame )

    (1)http://yemao.net/info/info.php?sessid=&infoid=62
    window.parent
    属性指定到顶部的帧

    (2)http://www.vbcity.com/forums/topic.asp?tid=83870
    The purpose of this FAQ is to explain how to refresh/redirect the contents of one frame from another frame

    Hey there everyone, this is something I have seen a lot of discussion about on other forums. There are so many suggestions, so many wrong answers - I figured I might as well point out a pretty simple and elegant solution to this isue. First thing is that you can use this regardless of your experience with Java script, I used this with C# code behind, but the VB code is almost identical. What you might use this for is to have a page posted or refreshed into a frame on the parent frame from inside another frame. Here we go then. I will show the code, then explain it. It is very simple so this will not take long.

    I am going to explain a bit more in detail as to why this snippet is useful in some situations. First, this is not the ONLY solution, nor most likely the BEST solution in EVERY case, however, it is a solution for when you are dealing with a frame that needs to have another frame refreshed, or reposted. When you are working in a frame, and use Response.Redirect, or Server.Transfer, the page is only redirected/reposted/refreshed to the current frame, not to another frame. This solution is for when you want to have one frame make another frame do something. Thank you Edward for pointing some of these out the me. Now on to the code - End Update.


    Code:

    string strRedirect;
    strRedirect = "<script language='Javascript'>";
    strRedirect += "parent.frames('FRAMENAME').location.href='ASP-PAGE.aspx';";
    strRedirect += "</script>";
    Response.Write(strRedirect);
    Response.Flush();

    Okay, pretty simple huh? It is a lot more elegant than some answers I have seen. To explain, you simply use Response.Write to send across a java scriplet that tells what frame and href to post with. I hope this helps some of you in controling where and how your pages post if you ever make a page with either frames or Iframes.

    Kent


    The section of the code....

    Code:
    Response.Write(strRedirect);
    Response.Flush();

    ...pushes the javascript to the page and redirects the target frame. It's designed to use for button, link button, or link clicks.

    The workaround works fine with IE but parent.frames is not working with Firefox. Use [] instead of ()


    Code:

    string strRedirect;
    strRedirect = "<script language='Javascript'>";
    strRedirect += "parent.frames['FRAMENAME'].location.href='ASP-PAGE.aspx';";
    strRedirect += "</script>";
    Response.Write(strRedirect);
    Response.Flush();


    Jean-Luc
    www.corobori.com

  • 相关阅读:
    系统管理玩玩Windows Azure
    元素集合Bloom Filter
    软考之编译原理
    保存位图位图保存时上下颠倒?
    委托函数《重构》处理概括关系
    运营商网络物联网操作系统再思考Hello China操作系统的运营商网络协同机制
    文件文档文档的词频反向文档频率(TFIDF)计算
    sphinx全文索引开源
    [转载]c#委托事件简单例子
    [转载]在C#事件处理中灵活应用泛型
  • 原文地址:https://www.cnblogs.com/cy163/p/259742.html
Copyright © 2011-2022 走看看