changing multiple frames onclick

A

Andy

Hi,

I am forced into using a frameset in which I divide the page into 3
frames, a "topframe" which is an area across the top, a "navframe"
which is an area just below the topframe and on the left column where
I put chapter heading links, and a "contentframe" which those links
update.

The whole reason for the frames is that the "contentframe" is based on
external html documents in a database that I have no control over and
which have their own css and images.

Thus, my first question is simple, how do I create <a href="...">
links in the "navframe" which update both the "contentframe" and the
"topframe".

My second question is what if I want more control than this. Lets say
my nav link wants to completely change the contents (location.href) of
the "contentframe" but only change one text widget in the "topframe".
Is this possible? Can it be done without annoying browser alerts?

Andy
 
A

Andy

I am forced into using a frameset in which I divide the page into 3
frames, a "topframe" which is an area across the top, a "navframe"
which is an area just below the topframe and on the left column where
I put chapter heading links, and a "contentframe" which those links
update.

A related question is this: I have a form with a <select> and set of
<option> for a menu. When I submit I want to update 2 of the target
frames with the same name/value pair selected by user. It would seem
that only the action attribute gets the query string with name/value
pair, and an onsubmit='top.topframe.location.href=/topservlet' event
would not send the name/value pair to the topservlet.
 
T

Thomas 'PointedEars' Lahn

Andy said:
Thus, my first question is simple, how do I create <a href="...">
links in the "navframe" which update both the "contentframe" and the
"topframe".

In a nutshell:

<a href="content.htm"
onclick="parent.frames['topframe'].location.top = 'top.htm'

Of course you would want to make some tests prior to assignment in a method
that you call in the `onclick' code instead.
My second question is what if I want more control than this. Lets say
my nav link wants to completely change the contents (location.href) of
the "contentframe" but only change one text widget in the "topframe".
Is this possible? Can it be done without annoying browser alerts?

Yes, you can find an example here: <http://PointedEars.de/ufpdb/main.en>
(the site is rather outdated, but still working). Select e.g. "Acamar III"
from the index on the left and see what happens in the content frame on the
right and in the top frame. Note the script code in the head of the content
document.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Andy said:
A related question is this: I have a form with a <select> and set of
<option> for a menu. When I submit I want to update 2 of the target
frames with the same name/value pair selected by user. It would seem
that only the action attribute gets the query string with name/value
pair, and an onsubmit='top.topframe.location.href=/topservlet' event
would not send the name/value pair to the topservlet.

Of course not, it

1. is syntactically invalid: top.topframe.location.href=/topservlet
the assigned value needs to be a string. If you delimit the
attribute value with <'>, you need to delimit the string value
with <">, and vice-versa.

2. does not contain a query part. You need to construct the query
part from the form controls and hidden inputs, using URL-encoding.

That is, provided the submission method required for the target resource is
GET in the first place. Else you need a second form (which can be created
dynamically) that you submit to a different target frame onsubmit the first
form.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Thomas said:
Andy said:
Thus, my first question is simple, how do I create <a href="...">
links in the "navframe" which update both the "contentframe" and the
"topframe".

In a nutshell:

<a href="content.htm"
onclick="parent.frames['topframe'].location.top = 'top.htm'

You need to append a " here to delimit the attribute value.


PointedEars
 

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

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top