用js操作其他frame总的的iframe路径
index.jsp:<frameset"><framesrc="top.jsp"name="topFrame"id="topFrame"/><framesrc="midd...
index.jsp:
<frameset">
<frame src="top.jsp" name="topFrame"id="topFrame" />
<frame src="middle.jsp" name="mainFrame" id="mainFrame" />
<frame src="down.jsp" name="bottomFrame" id="bottomFrame" />
</frameset>
现在需要在top.jsp中点击一个按钮,让middle.jsp中的页面改变
middle.jsp为:
<iframe src="a.jsp" id="link"/>
现在怎样在top.jsp中点击某个按钮,使a.jsp变成b.jsp呢? 展开
<frameset">
<frame src="top.jsp" name="topFrame"id="topFrame" />
<frame src="middle.jsp" name="mainFrame" id="mainFrame" />
<frame src="down.jsp" name="bottomFrame" id="bottomFrame" />
</frameset>
现在需要在top.jsp中点击一个按钮,让middle.jsp中的页面改变
middle.jsp为:
<iframe src="a.jsp" id="link"/>
现在怎样在top.jsp中点击某个按钮,使a.jsp变成b.jsp呢? 展开
2个回答
展开全部
只需在top框架中的页面中加按钮 执行这个JavaScript:
window.parent.frames["mainFrame"].location.href="新页面.jsp"
window.parent.frames["mainFrame"].location.href="新页面.jsp"
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="YangHui">
<META NAME="Keywords" CONTENT="YangHui">
<META NAME="Description" CONTENT="YangHui">
<SCRIPT LANGUAGE="JavaScript">
<!--
function setColor(c){
var r = Math.floor((Math.random() * 256)).toString(16);
var g = Math.floor((Math.random() * 256)).toString(16);
var b = Math.floor((Math.random() * 256)).toString(16);
var colorString = "#" + r + g + b;
c.document.write("<body bgcolor='" + colorString +"'></body>");
c.document.close();
setTimeout("setColor(" + c.name +")", 1000);//c.setTimeout("parent.setColor(parent."+ c.name +")" , 1000);
}
//-->
</SCRIPT>
</HEAD>
<FRAMESET ROWS="33%,34%,33%" COLS="33%,34%,33%" onload="for(var i=0;i<9;i++) setColor(frames[i]);">
<FRAME SRC="javascript:''" NAME="f1">
<FRAME SRC="javascript:''" NAME="f2">
<FRAME SRC="javascript:''" NAME="f3">
<FRAME SRC="javascript:''" NAME="f4">
<FRAME SRC="javascript:''" NAME="f5">
<FRAME SRC="javascript:''" NAME="f6">
<FRAME SRC="javascript:''" NAME="f7">
<FRAME SRC="javascript:''" NAME="f8">
<FRAME SRC="javascript:''" NAME="f9">
</FRAMESET>
</HTML>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="YangHui">
<META NAME="Keywords" CONTENT="YangHui">
<META NAME="Description" CONTENT="YangHui">
<SCRIPT LANGUAGE="JavaScript">
<!--
function setColor(c){
var r = Math.floor((Math.random() * 256)).toString(16);
var g = Math.floor((Math.random() * 256)).toString(16);
var b = Math.floor((Math.random() * 256)).toString(16);
var colorString = "#" + r + g + b;
c.document.write("<body bgcolor='" + colorString +"'></body>");
c.document.close();
setTimeout("setColor(" + c.name +")", 1000);//c.setTimeout("parent.setColor(parent."+ c.name +")" , 1000);
}
//-->
</SCRIPT>
</HEAD>
<FRAMESET ROWS="33%,34%,33%" COLS="33%,34%,33%" onload="for(var i=0;i<9;i++) setColor(frames[i]);">
<FRAME SRC="javascript:''" NAME="f1">
<FRAME SRC="javascript:''" NAME="f2">
<FRAME SRC="javascript:''" NAME="f3">
<FRAME SRC="javascript:''" NAME="f4">
<FRAME SRC="javascript:''" NAME="f5">
<FRAME SRC="javascript:''" NAME="f6">
<FRAME SRC="javascript:''" NAME="f7">
<FRAME SRC="javascript:''" NAME="f8">
<FRAME SRC="javascript:''" NAME="f9">
</FRAMESET>
</HTML>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询