hyperlinking 2 frame targets w. Javascript

M

Michael

Hello,

A FrontPage book I have describes a technique for simultaneously changing
content in two windows of a frames page using javascript. The idea is that
when you click a hyperlink in the top frame, the .htm file in the top frame
changes and so does the .htm file in the bottom frame.

The book I have says to put Javascript in the hyperlink like the following:

javascript:parent.frames.framename1.location='page2.htm';parent.frames.framename2.location='bottompage2.htm'

However, when I do this, the result is that the browser window clears
entirely (no more frames) and the target page for the top frame takes up the
entire browser window. The bottom frame isn't displayed anywhere.

In toying around with it, I tried eliminating the second javascript command
for the bottom window, to see if I could even change just the content in the
top frame with javascript, so I changed it to

javascript:parent.frames.framename1.location='page2.htm'

But in that instance, the same thing occurs: the frames disappear and
page2.htm takes up the entire browser window (the address line shows the
page2.htm address, not the address of the frames page).

I read a similar thread on this forum and the advice was to use the syntax

javascript:window.parent.top.location='page2.htm'

so parent.frames was replaced with window.parent. I tried that and get the
same result as I had previously.

Does anyone know how I can get this to work, so that when I click a link in
the top frame, a new page is rendered in both the top frame and the bottom
frame?

Thank you.

- Michael Gibbons

Frameset HTML:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>CS600 Demonstration Site - Michael Gibbons</title>
</head>

<frameset rows="24%,*">
<frame name="top" src="demo1.htm" target="none">
<frame name="bottom" src="default.asp">
<noframes>
<body>

<p>This page uses frames, but your browser doesn't support them.</p>

</body>
</noframes>
</frameset>

</html>

Top frame html: (the one with the javascript problem)

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Title goes here</title>
</head>

<body>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="29%" rowspan="2">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber2">
<tr>
some text
</tr>
some text
</tr>
2 </table>
</td>
<td width="71%" valign="top"><font face="Verdana" size="2">
some text
</td>
</tr>
<tr>
<td width="71%" valign="bottom">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
id="AutoNumber3">
<tr>
<td width="17%"><font face="Verdana" size="1"><a
href="demo1.htm">Previous</a></font></td>
<td width="17%"><font face="Verdana" size="1">
<a
href="javascript:window.parent.top.location='demo3.htm';window.parent.bottom.location='2.asp'">Next</a></font></td>
<td width="116%" valign="bottom"><font face="Verdana" size="1">
<a target="_top" href="cs600.htm">Start Over</a></font></td>
</tr>
</table>
</td>
</tr>
</table>

</body>

</html>

Bottom frame html:

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Title here</title>
</head>

<body>

Some text

</body>

</html>
 
J

Jon Spivey

Hi Michael,
Try it like this

<a href="javascript:;"
onclick="parent.NameOfTopFrame.location.href='page1.htm';
parent.NameOfBottomFrame.location.href='page2.htm'; return false;">
 
M

Michael

Same result.

Jon Spivey said:
Hi Michael,
Try it like this

<a href="javascript:;"
onclick="parent.NameOfTopFrame.location.href='page1.htm';
parent.NameOfBottomFrame.location.href='page2.htm'; return false;">
 
B

Bob Lehmann

So, are you replacing "NameOfTopFrame" or "framename1" with the actual name
of the frame target?

Bob Lehmann
 
J

Jon Spivey

Michael,
Can you stick the offending page up on the web somewhere and give us a link?
 
M

Michael

I think I see what the problem is. One of the pages I am trying to load in my
bottom frame is an asp page. I think the asp page is fouling this up somehow.
I should have thought of that before.

Given that it's asp in the bottom frame, is there an easy way to do this?

PS: I didn't suspect asp because in the initial frames page I had asp in the
bottom frame to begin with.
 
S

Stefan B Rusynko

That makes no difference (.asp or .htm ) as long as you use the correct one for the page link you need
- but I don't see at your referenced page at http://www.michaelgibbons.org/cs600/cs600.htm any JavaScript links per Jon's advise
(explain which link in which frame you want to do what)




|I think I see what the problem is. One of the pages I am trying to load in my
| bottom frame is an asp page. I think the asp page is fouling this up somehow.
| I should have thought of that before.
|
| Given that it's asp in the bottom frame, is there an easy way to do this?
|
| PS: I didn't suspect asp because in the initial frames page I had asp in the
| bottom frame to begin with.
|
| "Michael" wrote:
|
| >
| > http://www.michaelgibbons.org/cs600/cs600.htm
| >
| > "Jon Spivey" wrote:
| >
| > > Michael,
| > > Can you stick the offending page up on the web somewhere and give us a link?
| > >
| > > --
| > > Cheers,
| > > Jon
| > > Microsoft MVP
| > >
| > > | > > > Yes. The name that is in the "Frame Properties" window in Frontpage.
| > > >
| > > > "Bob Lehmann" wrote:
| > > >
| > > >> So, are you replacing "NameOfTopFrame" or "framename1" with the actual
| > > >> name
| > > >> of the frame target?
| > > >>
| > > >> Bob Lehmann
| > > >>
| > > >> | > > >> > Same result.
| > > >> >
| > > >> > "Jon Spivey" wrote:
| > > >> >
| > > >> > > Hi Michael,
| > > >> > > Try it like this
| > > >> > >
| > > >> > > <a href="javascript:;"
| > > >> > > onclick="parent.NameOfTopFrame.location.href='page1.htm';
| > > >> > > parent.NameOfBottomFrame.location.href='page2.htm'; return false;">
| > > >> > >
| > > >> > > --
| > > >> > > Cheers,
| > > >> > > Jon
| > > >> > > Microsoft MVP
| > > >> > >
| > > >> > > | > > >> > > > Hello,
| > > >> > > >
| > > >> > > > A FrontPage book I have describes a technique for simultaneously
| > > >> changing
| > > >> > > > content in two windows of a frames page using javascript. The idea
| > > >> > > > is
| > > >> that
| > > >> > > > when you click a hyperlink in the top frame, the .htm file in the
| > > >> > > > top
| > > >> > > > frame
| > > >> > > > changes and so does the .htm file in the bottom frame.
| > > >> > > >
| > > >> > > > The book I have says to put Javascript in the hyperlink like the
| > > >> > > > following:
| > > >> > > >
| > > >> > > >
| > > >> javascript:parent.frames.framename1.location='page2.htm';parent.frames.frame
| > > >> name2.location='bottompage2.htm'
| > > >> > > >
| > > >> > > > However, when I do this, the result is that the browser window
| > > >> > > > clears
| > > >> > > > entirely (no more frames) and the target page for the top frame
| > > >> > > > takes
| > > >> up
| > > >> > > > the
| > > >> > > > entire browser window. The bottom frame isn't displayed anywhere.
| > > >> > > >
| > > >> > > > In toying around with it, I tried eliminating the second javascript
| > > >> > > > command
| > > >> > > > for the bottom window, to see if I could even change just the
| > > >> > > > content
| > > >> in
| > > >> > > > the
| > > >> > > > top frame with javascript, so I changed it to
| > > >> > > >
| > > >> > > > javascript:parent.frames.framename1.location='page2.htm'
| > > >> > > >
| > > >> > > > But in that instance, the same thing occurs: the frames disappear
| > > >> > > > and
| > > >> > > > page2.htm takes up the entire browser window (the address line
| > > >> > > > shows
| > > >> the
| > > >> > > > page2.htm address, not the address of the frames page).
| > > >> > > >
| > > >> > > > I read a similar thread on this forum and the advice was to use the
| > > >> syntax
| > > >> > > >
| > > >> > > > javascript:window.parent.top.location='page2.htm'
| > > >> > > >
| > > >> > > > so parent.frames was replaced with window.parent. I tried that and
| > > >> > > > get
| > > >> the
| > > >> > > > same result as I had previously.
| > > >> > > >
| > > >> > > > Does anyone know how I can get this to work, so that when I click a
| > > >> link
| > > >> > > > in
| > > >> > > > the top frame, a new page is rendered in both the top frame and the
| > > >> bottom
| > > >> > > > frame?
| > > >> > > >
| > > >> > > > Thank you.
| > > >> > > >
| > > >> > > > - Michael Gibbons
| > > >> > > >
| > > >> > > > Frameset HTML:
| > > >> > > >
| > > >> > > > <html>
| > > >> > > >
| > > >> > > > <head>
| > > >> > > > <meta http-equiv="Content-Type" content="text/html;
| > > >> charset=windows-1252">
| > > >> > > > <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
| > > >> > > > <meta name="ProgId" content="FrontPage.Editor.Document">
| > > >> > > > <title>CS600 Demonstration Site - Michael Gibbons</title>
| > > >> > > > </head>
| > > >> > > >
| > > >> > > > <frameset rows="24%,*">
| > > >> > > > <frame name="top" src="demo1.htm" target="none">
| > > >> > > > <frame name="bottom" src="default.asp">
| > > >> > > > <noframes>
| > > >> > > > <body>
| > > >> > > >
| > > >> > > > <p>This page uses frames, but your browser doesn't support
| > > >> > > > them.</p>
| > > >> > > >
| > > >> > > > </body>
| > > >> > > > </noframes>
| > > >> > > > </frameset>
| > > >> > > >
| > > >> > > > </html>
| > > >> > > >
| > > >> > > > Top frame html: (the one with the javascript problem)
| > > >> > > >
| > > >> > > > <html>
| > > >> > > >
| > > >> > > > <head>
| > > >> > > > <meta http-equiv="Content-Language" content="en-us">
| > > >> > > > <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
| > > >> > > > <meta name="ProgId" content="FrontPage.Editor.Document">
| > > >> > > > <meta http-equiv="Content-Type" content="text/html;
| > > >> charset=windows-1252">
| > > >> > > > <title>Title goes here</title>
| > > >> > > > </head>
| > > >> > > >
| > > >> > > > <body>
| > > >> > > >
| > > >> > > > <table border="0" cellpadding="0" cellspacing="0"
| > > >> style="border-collapse:
| > > >> > > > collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
| > > >> > > > <tr>
| > > >> > > > <td width="29%" rowspan="2">
| > > >> > > > <table border="0" cellpadding="0" cellspacing="0"
| > > >> > > > style="border-collapse: collapse" bordercolor="#111111"
| > > >> > > > width="100%"
| > > >> > > > id="AutoNumber2">
| > > >> > > > <tr>
| > > >> > > > some text
| > > >> > > > </tr>
| > > >> > > > some text
| > > >> > > > </tr>
| > > >> > > > 2 </table>
| > > >> > > > </td>
| > > >> > > > <td width="71%" valign="top"><font face="Verdana" size="2">
| > > >> > > > some text
| > > >> > > > </td>
| > > >> > > > </tr>
| > > >> > > > <tr>
| > > >> > > > <td width="71%" valign="bottom">
| > > >> > > > <table border="0" cellpadding="0" cellspacing="0"
| > > >> > > > style="border-collapse: collapse" bordercolor="#111111"
| > > >> > > > width="100%"
| > > >> > > > id="AutoNumber3">
| > > >> > > > <tr>
| > > >> > > > <td width="17%"><font face="Verdana" size="1"><a
| > > >> > > > href="demo1.htm">Previous</a></font></td>
| > > >> > > > <td width="17%"><font face="Verdana" size="1">
| > > >> > > > <a
| > > >> > > >
| > > >> href="javascript:window.parent.top.location='demo3.htm';window.parent.bottom
| > > >> ..location='2.asp'">Next</a></font></td>
| > > >> > > > <td width="116%" valign="bottom"><font face="Verdana"
| > > >> > > > size="1">
| > > >> > > > <a target="_top" href="cs600.htm">Start Over</a></font></td>
| > > >> > > > </tr>
| > > >> > > > </table>
| > > >> > > > </td>
| > > >> > > > </tr>
| > > >> > > > </table>
| > > >> > > >
| > > >> > > > </body>
| > > >> > > >
| > > >> > > > </html>
| > > >> > > >
| > > >> > > > Bottom frame html:
| > > >> > > >
| > > >> > > > <html>
| > > >> > > >
| > > >> > > > <head>
| > > >> > > > <meta http-equiv="Content-Language" content="en-us">
| > > >> > > > <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
| > > >> > > > <meta name="ProgId" content="FrontPage.Editor.Document">
| > > >> > > > <meta http-equiv="Content-Type" content="text/html;
| > > >> charset=windows-1252">
| > > >> > > > <title>Title here</title>
| > > >> > > > </head>
| > > >> > > >
| > > >> > > > <body>
| > > >> > > >
| > > >> > > > Some text
| > > >> > > >
| > > >> > > > </body>
| > > >> > > >
| > > >> > > > </html>
| > > >> > >
| > > >> > >
| > > >> > >
| > > >>
| > > >>
| > > >>
| > >
| > >
| > >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top