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

  • 相关阅读:
    【Jquery系列】详解Jquery对象和Dom对象
    将博客搬至CSDN
    【工具篇】.NET开发常用工具
    【ASP.NET MVC系列】浅谈jqGrid 在ASP.NET MVC中增删改查
    【SqlServer】【问题收集】必须声明标量变量
    【SqlServer】【问题收集】删除同一张表中完全相同的记录
    【SqlServer】【问题收集】阻止保存要求重新创建表的更改
    Java多线程编程中Future模式的详解<转>
    Java后端,应该日常翻看的中文技术网站<转>
    PostgreSql 函数
  • 原文地址:https://www.cnblogs.com/cy163/p/259742.html
Copyright © 2011-2022 走看看