【问题标题】:Form targeting iframe表单定位 iframe
【发布时间】:2012-07-27 14:03:27
【问题描述】:

我有一个带有两个 iframe 的 index.html 页面:

<html><head><title>DOM KPI</title></head>
<body bgcolor='oldlace'>
<iframe src="main.cgi" id=main width=40% height=100% frameborder=0 ></iframe>
<iframe src="graphs2.cgi" id=graph  frameborder=0 width=60% height=100%></iframe>
</body>
</html>

主页是一个 cgi,它将向图形 iframe 发送输出。现在,当我单击它时,它会在其他选项卡中打开 grap2.cgi。

main.cgi 程序的窗体行。

&lt;form name="domformula" action="graphs2.cgi" method="post" target="graph" &gt;

有人可以帮帮我吗?

非常感谢

【问题讨论】:

  • 这对我来说看起来不太好。避免仅仅为了它而放入框架。
  • 这是我们部门专用的公司服务器。我将 apache 用于将打开 de index.html 页面的窗口的主要目的。 index.html 页面有两个 iframe。一帧将询问 de DOM 的 ip、图表公式和日期。我想在 iframe 旁边绘制该信息。

标签: html forms iframe target


【解决方案1】:

这里的问题是您有一个带有两个子 iframe 页面的父页面。一个孩子试图在没有先通过父页面的情况下给另一个孩子打电话。

您可以使用 JavaScript 执行此操作,以便将其路由到父页面。

parent.graph.document.location="http://yoururl.cgi"

【讨论】:

  • 感谢您的回答。我编辑了 main.cgi 并添加了行 但不工作。我做错了什么??
  • 谢谢我一直在努力并且可以做到!
【解决方案2】:

我能做到!

我只需要在 index.html 上添加 iframe 的名称

<iframe src="main.cgi" id=main name=main width=420px height=100% frameborder=0 ></iframe>
<iframe src="graphs2.cgi" id=graph name=graph frameborder=0  width=650px height=100%></iframe>

在 main.cgi 我添加以下内容:

<script>
        parent.graph.document.location="graphs2.cgi";
    </script>

非常感谢!

【讨论】:

    猜你喜欢
    • 2015-09-07
    • 2015-06-16
    • 2012-03-09
    • 2016-08-17
    • 2013-03-13
    • 1970-01-01
    • 1970-01-01
    • 2014-12-27
    • 1970-01-01
    相关资源
    最近更新 更多