一个页面中两个iframe,如何在左边的iframe中点击连接找开右边的iframe页面?

lbl8888 2010-01-30 02:39:43
一个页面中包含两个iframe,左边和右边,两个iframe分别包含两个页面,如何在左边的iframe包含的页面中点击打开右边的iframe包含的页面?现在一点击就把整个页面变成右边的页面内容了,如何点击左边的页面改变右边的页面,而左边的内容不变?
...全文
2295 19 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
-Xs_ 2012-06-21
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 的回复:]
在左边的iframe中的页面中写下你想打开页面的链接
<a href="test.html" target="右边iframe的名称">在右边页面显示本页面</a>
[/Quote]

能写详细点代码么? 楼主的为例...我的转不过去
zzwf1 2012-04-30
  • 打赏
  • 举报
回复
试试8楼的做法
a4535361 2011-12-12
  • 打赏
  • 举报
回复
你2个页面中的main这个右边的名字一样了,冲突了,就造成了点左边的,右边的把左边的也覆盖了,你把一个页面的右侧名字改动一下就OK了
crazylaa 2010-01-30
  • 打赏
  • 举报
回复
d.add(";
htmlString += myID + ",";
htmlString += pID + ",";
htmlString += "'" + viewName + "'" + ",";
htmlString += "'" + isFolder + "'" + ",";
htmlString += "'" + myUrl + "'" + ",";
htmlString += "'" + title + "'" + ",";
htmlString += "'" + target + "'" + ");\n";

这里的target就是你的右边的那个frame的名字
crazylaa 2010-01-30
  • 打赏
  • 举报
回复
dtree支持,add的时候,把target加进去即可,给你个例子:


private String htmlString = "";
private void showTree(TreeNode rootNode) throws Exception{
String myID = rootNode.getNodeName();//得到本身id

if (myID==null||myID.equals(""))
throw new Exception("由于数据库连接失败或其他原因,无法取得系统参数树的根节点,请稍后再试!");
String pID = "";//得到父ID
if(rootNode.getDepth()==1) //如果是根节点
pID = "-1";
else
pID = rootNode.getParentNode().getNodeName();
String viewName = rootNode.getNodeViewName();
String isFolder = "1";//是否显示为文件夹
if(rootNode.isLeafNode())
isFolder = "";
String myUrl = "#";//链接
String title = "";
String target = "mainFrame";
myUrl = "/daSysConfig.do?functionName=QUERYDASYSCONFIG&functionData=" + rootNode.getNodeName();
htmlString += "d.add(";
htmlString += myID + ",";
htmlString += pID + ",";
htmlString += "'" + viewName + "'" + ",";
htmlString += "'" + isFolder + "'" + ",";
htmlString += "'" + myUrl + "'" + ",";
htmlString += "'" + title + "'" + ",";
htmlString += "'" + target + "'" + ");\n";
if(!rootNode.hasChildNode()){
return;
}
ArrayList arrayList_ChildNode = rootNode.getChildNodes();
for(int i=0; i<arrayList_ChildNode.size(); i++) {
TreeNode childNode = (TreeNode)arrayList_ChildNode.get(i);
showTree(childNode);
}
}
lbl8888 2010-01-30
  • 打赏
  • 举报
回复
是这样的,我左边的页面是一个dtree,好像不支持这样写
crazylaa 2010-01-30
  • 打赏
  • 举报
回复
基本就是个iframe的target问题了。楼主慢慢试。
wolfsta 2010-01-30
  • 打赏
  • 举报
回复
晕!你点击右边左边变和点击左边右边变有什么本质区别吗?就是点击当前iframe让本页另一个iframe变化呗!调整一下指向就可以了呗!要不你就把你页面整个发上来多好!
lbl8888 2010-01-30
  • 打赏
  • 举报
回复
8楼的方法是可以,但不能自动执行啊,你的连接写在右边,我要的是在左边点击右边变啊,6楼的方法不行,这样新打开了一个窗口,没有在原窗口中啊
wolfsta 2010-01-30
  • 打赏
  • 举报
回复
顶8楼的,感觉做成这样的连接最方便!要是按钮的话就得用JS做定向了吧!总体来说就是做一个指向,连接的时候指定他的显示iframe就可以啦!
jypapgl 2010-01-30
  • 打赏
  • 举报
回复
收藏
往何 2010-01-30
  • 打赏
  • 举报
回复
在左边的iframe中的页面中写下你想打开页面的链接
<a href="test.html" target="右边iframe的名称">在右边页面显示本页面</a>
sotom 2010-01-30
  • 打赏
  • 举报
回复
上边应该是右侧的iframe名称。。。说错了。

sotom 2010-01-30
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 lbl8888 的回复:]
是这样的,一共是三个页面,主页面包含两个iframe,iframe包含两个页面,现在是想在左边的iframe包含的页面中点击链接打开右边的iframe的那个页面,左边的不变
[/Quote]


window.open("连接","左侧Iframe名称");
lbl8888 2010-01-30
  • 打赏
  • 举报
回复
左边的iframe包含的页面中window.parent.frames["frame2"].document......得不到
lbl8888 2010-01-30
  • 打赏
  • 举报
回复
是这样的,一共是三个页面,主页面包含两个iframe,iframe包含两个页面,现在是想在左边的iframe包含的页面中点击链接打开右边的iframe的那个页面,左边的不变
sotom 2010-01-30
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 sotom 的回复:]
如果是提交左侧iframe的页面在右侧iframe显示数据可以这样


HTML code<iframename="frame1"><formaction="" .... target="frame2"</ifram><iframename="frame2"></frame>


如果是超链接可以使用JavaScript
window.open("xxxx.jsp","frame2");
[/Quote]

sotom 2010-01-30
  • 打赏
  • 举报
回复
或者

window.parent.frames["frame2"].document......



很多方法的。呵呵。
sotom 2010-01-30
  • 打赏
  • 举报
回复
如果是提交左侧iframe的页面在右侧iframe显示数据可以这样


<iframe name="frame1">
<form action="" .... target="frame2"

</ifram>

<iframe name="frame2">


</frame>



如果是超链接可以使用JavaScript

window.open("xxxx.jsp","frame2");

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧