大家好,有个问题向大家请教!
在一个html窗体(main.htm)中,有三个frame
<frameset framespacing="0" border="0" frameborder="0" rows="116,*,2%">
<frame name="top" scrolling="no" noresize target="middle" src="../pub/top.aspx">
<frame name="middle" target="bottom" src="../middle.htm"
scrolling="auto" noresize>
<frame name="bottom" scrolling="no" src="../pub/boot.htm"
noresize>
<noframes>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0"
onmouseover="parent.status='HQS';return true" >
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>现在,我想通过接收接收传递过来的参数,根据不同的参数值,指定middle这个frame的不同的src值,
如:main.htm?Aim=aaaa ,我想将middle的src设置为:aaaa.aspx
不知道如何写,请大家指教!
我的javascript是这样写的
<script language=javascript >
enterDiffAim();
function enterDiffAim() //进入页面后,根据传递进来的参数,进入 相应子页面
{
var url=window.location .href;
var aa=url.indexOf('='); if (aa == -1)
return ""; url=url.substring(aa+1);
if (url == "aaaa")
{
//这里不知道如何写了,
parent.document.frames("middle").document.location.href="../pub/aaaa.aspx"; //这样写不行
}
}
</script>
在一个html窗体(main.htm)中,有三个frame
<frameset framespacing="0" border="0" frameborder="0" rows="116,*,2%">
<frame name="top" scrolling="no" noresize target="middle" src="../pub/top.aspx">
<frame name="middle" target="bottom" src="../middle.htm"
scrolling="auto" noresize>
<frame name="bottom" scrolling="no" src="../pub/boot.htm"
noresize>
<noframes>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0"
onmouseover="parent.status='HQS';return true" >
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>现在,我想通过接收接收传递过来的参数,根据不同的参数值,指定middle这个frame的不同的src值,
如:main.htm?Aim=aaaa ,我想将middle的src设置为:aaaa.aspx
不知道如何写,请大家指教!
我的javascript是这样写的
<script language=javascript >
enterDiffAim();
function enterDiffAim() //进入页面后,根据传递进来的参数,进入 相应子页面
{
var url=window.location .href;
var aa=url.indexOf('='); if (aa == -1)
return ""; url=url.substring(aa+1);
if (url == "aaaa")
{
//这里不知道如何写了,
parent.document.frames("middle").document.location.href="../pub/aaaa.aspx"; //这样写不行
}
}
</script>
parent.document.frames("middle").document.location.href="../pub/aaaa.aspx"; //这样写不行改为
document.all.middle.src=="../pub/aaaa.aspx";
sprc_lcl(cool一生) 因为你这个javascript并没有在某一个frame中执行,而是在FrameSet所在的页面执行的
parent.document.frames("middle").document.location.href="../pub/aaaa.aspx"; //这样写不行改为
document.all["middle"].src="../pub/aaaa.aspx";
或者:
middle.src ="../pub/aaaa.aspx";
或:
middle.location.href = "../pub/aaaa.aspx";
或:
middle.location ="../pub/aaaa.aspx";你多试试
你所说的话到叶面代码的最下面是指的放到叶面的哪一个部分?
是不是考虑执行代码的时候,没有初始化相应frame?
<%@ Page language="c#" Codebehind="main.aspx.cs" AutoEventWireup="false" Inherits="OT.HQS.Web.main" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head >
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>********系统</title>
<script language=javascript >
self.resizeTo(screen.availWidth,screen.availHeight);
enterDiffAim() ;
function enterDiffAim() //进入页面后,根据传递进来的参数,进入 相应子页面
{
var url=window.location .href;
var aa=url.indexOf('='); if (aa == -1)
return ""; url=url.substring(aa+1);
if (url == "aaaa")
{
alert(url);
//window.middle .src="../pub/boot.htm" ;
//window.parent.frames['middle'].location.href =
//parent.document.frames("main").document.all.txtclassid.value=tmp;
//parent.document.frames("middle").document.location.href="../pub/boot.htm";
//document.all.middle.location.herf = "../pub/boot.htm";
//window.frames(1).location.href = "../pub/boot.htm" ;
//document.all["middle"].src="../pub/boot.htm" ;
//middle.src ="../pub/boot.htm" ;
middle.location.href = "../pub/boot.htm" ;
//middle.location ="../pub/boot.htm" ; }
}
</script>
</head>
<frameset framespacing="0" border="0" frameborder="0" rows="116,*,2%">
<frame name="top" scrolling="no" noresize target="middle" src="../pub/top.aspx">
<frame name="middle" target="bottom" src="../middle.htm"
scrolling="auto" noresize>
<frame name="bottom" scrolling="no" src="../pub/boot.htm"
noresize>
<noframes>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0"
onmouseover="parent.status='HQS';return true" >
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body >
</noframes>
</frameset>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head >
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>********系统</title>
</head>
<frameset framespacing="0" border="0" frameborder="0" rows="116,*,2%">
<frame name="top" scrolling="no" noresize target="middle" src="../pub/top.aspx">
<frame name="middle" target="bottom" src="../middle.htm"
scrolling="auto" noresize>
<frame name="bottom" scrolling="no" src="../pub/boot.htm"
noresize>
<noframes>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0"
onmouseover="parent.status='HQS';return true" >
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body >
</noframes>
</frameset>
</html>
<script language=javascript >
self.resizeTo(screen.availWidth,screen.availHeight);
enterDiffAim() ;
function enterDiffAim() //进入页面后,根据传递进来的参数,进入 相应子页面
{
var url=window.location .href;
var aa=url.indexOf('='); if (aa == -1)
return ""; url=url.substring(aa+1);
if (url == "aaaa")
{
alert(url);
//window.middle .src="../pub/boot.htm" ;
//window.parent.frames['middle'].location.href =
//parent.document.frames("main").document.all.txtclassid.value=tmp;
//parent.document.frames("middle").document.location.href="../pub/boot.htm";
//document.all.middle.location.herf = "../pub/boot.htm";
//window.frames(1).location.href = "../pub/boot.htm" ;
//document.all["middle"].src="../pub/boot.htm" ;
//middle.src ="../pub/boot.htm" ;
middle.location.href = "../pub/boot.htm" ;
//middle.location ="../pub/boot.htm" ; }
}
</script>你就改成这样吧,应该可以的
enterDiffAim() ;这两个方法怎么去调用执行呢?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head >
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>********系统</title>
</head><script language=javascript >
self.resizeTo(screen.availWidth,screen.availHeight); function enterDiffAim() //进入页面后,根据传递进来的参数,进入 相应子页面
{
var url=window.location .href;
var aa=url.indexOf('='); if (aa == -1)
return ""; url=url.substring(aa+1);
if (url == "aaaa")
{
alert(url);
//window.middle .src="../pub/boot.htm" ;
//window.parent.frames['middle'].location.href =
//parent.document.frames("main").document.all.txtclassid.value=tmp;
//parent.document.frames("middle").document.location.href="../pub/boot.htm";
//document.all.middle.location.herf = "../pub/boot.htm";
//window.frames(1).location.href = "../pub/boot.htm" ;
//document.all["middle"].src="../pub/boot.htm" ;
//middle.src ="../pub/boot.htm" ;
middle.location.href = "../pub/boot.htm" ;
//middle.location ="../pub/boot.htm" ; }
}
</script>
<frameset framespacing="0" border="0" frameborder="0" rows="116,*,2%">
<frame name="top" scrolling="no" noresize target="middle" src="../pub/top.aspx">
<frame name="middle" target="bottom" src="../middle.htm"
scrolling="auto" noresize>
<frame name="bottom" scrolling="no" src="../pub/boot.htm"
noresize>
<noframes>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0"
onmouseover="parent.status='HQS';return true" >
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body >
</noframes>
</frameset>
</html>
<script language=javascript>
enterDiffAim();
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head >
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>********系统</title>
</head><script language=javascript >
self.resizeTo(screen.availWidth,screen.availHeight); function enterDiffAim() //进入页面后,根据传递进来的参数,进入 相应子页面
{
var url=window.location .href;
var aa=url.indexOf('='); if (aa == -1)
return ""; url=url.substring(aa+1);
if (url == "aaaa")
{
alert(url);
document.all.middle.location.href = "../pub/boot.htm" ;
}
}
</script>
<frameset framespacing="0" border="0" frameborder="0" rows="116,*,2%">
<frame name="top" scrolling="no" noresize target="middle" src="../pub/top.aspx">
<frame name="middle" target="bottom" src="../middle.htm"
scrolling="auto" noresize>
<frame name="bottom" scrolling="no" src="../pub/boot.htm"
noresize>
<noframes>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0"
onmouseover="parent.status='HQS';return true" >
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body >
</noframes>
</frameset>
</html>
<script language=javascript>
enterDiffAim();
</script>
呵呵,谢谢你了,我再试一下,看一下有没有其它问题,谢谢你!!
谢谢你了,