ileens
asked on
Controll frame's content on event onload
This is my frameset :
<frameset border=0 rows="71,*,15">
<frame name=up src="up.html" frameborder=no scrolling=no noresize>
<frameset border=0 cols="88,*" >
<frame name=left src="left.html" frameborder=no scrolling=no noresize>
<frameset border=1 rows="82,*" >
<frame name=menu src="menu.html" frameborder=no scrolling=no noresize>
<frame name=main src="main.html" frameborder=no scrolling=auto>
</frameset>
</frameset>
<frame name=down src="down.html" frameborder=no scrolling=no noresize>
</frameset>
I need to change specific image in frame name- MENU
each time the MAIN frame is loading.
Meaning:
in main.html ---
<body onload=FixMenuImage('xxx.g if')>
How do tell the MENU-frame to change the image ???
<frameset border=0 rows="71,*,15">
<frame name=up src="up.html" frameborder=no scrolling=no noresize>
<frameset border=0 cols="88,*" >
<frame name=left src="left.html" frameborder=no scrolling=no noresize>
<frameset border=1 rows="82,*" >
<frame name=menu src="menu.html" frameborder=no scrolling=no noresize>
<frame name=main src="main.html" frameborder=no scrolling=auto>
</frameset>
</frameset>
<frame name=down src="down.html" frameborder=no scrolling=no noresize>
</frameset>
I need to change specific image in frame name- MENU
each time the MAIN frame is loading.
Meaning:
in main.html ---
<body onload=FixMenuImage('xxx.g
How do tell the MENU-frame to change the image ???
ASKER
mplungjan:
Please explain your comment.
Thanks Ileen.
Please explain your comment.
Thanks Ileen.
you have an image in the menu frame?
Syntax for chaning images is
(window.)document.images[' imagename' ].src='ima ge.gif'
If it is coded like this:
<img src="yyy.gif" name="myImage">
either
top.menu.document.images[' myImage']. src='xxx.g if'
or
top.left.menu.document.ima ges['myIma ge'].src=' xxx.gif'
In a function it would be
function FixMenuImage(img) {
top.left.menu.document.ima ges['myIma ge'].src=i mg
}
but since menu might not have been loaded or main was loaded outside the frameset, I add a test:
function FixMenuImage(img) {
if (!document.images) return; /* this browser does not support image swapping */
if (top.left && top.left.menu &&
top.left.menu.document.ima ges['myIma ge']) { /*Is the frame, document and image there? */
top.left.menu.document.ima ges['myIma ge'].src=i mg
}
Michel
Syntax for chaning images is
(window.)document.images['
If it is coded like this:
<img src="yyy.gif" name="myImage">
either
top.menu.document.images['
or
top.left.menu.document.ima
In a function it would be
function FixMenuImage(img) {
top.left.menu.document.ima
}
but since menu might not have been loaded or main was loaded outside the frameset, I add a test:
function FixMenuImage(img) {
if (!document.images) return; /* this browser does not support image swapping */
if (top.left && top.left.menu &&
top.left.menu.document.ima
top.left.menu.document.ima
}
Michel
ASKER
Thank you Michel.
It keeps giving me two Errors:
When loading the frameset,
1. Expected '}'
2. Object expected.
It doesn't get to the function it stops on the declaretion
(Definition) in the Onload event.
My syntax is :
<body LANGUAGE=javascript onload="return FixMenuImage('images/title _company.g if')">
And the same function as you wrote it.
(In the Manu page I only set the name inside the img tag.
Do I need to set a verible or something?)
Thanks for your help.
It keeps giving me two Errors:
When loading the frameset,
1. Expected '}'
2. Object expected.
It doesn't get to the function it stops on the declaretion
(Definition) in the Onload event.
My syntax is :
<body LANGUAGE=javascript onload="return FixMenuImage('images/title
And the same function as you wrote it.
(In the Manu page I only set the name inside the img tag.
Do I need to set a verible or something?)
Thanks for your help.
Missed a curly:
function FixMenuImage(img) {
if (!document.images) return; /* this browser does not support image swapping */
if (top.left && top.left.menu &&
top.left.menu.document.ima ges['myIma ge']) { /*Is the frame, document and image there? */
top.left.menu.document.ima ges['myIma ge'].src=i mg
}
}
Michel
function FixMenuImage(img) {
if (!document.images) return; /* this browser does not support image swapping */
if (top.left && top.left.menu &&
top.left.menu.document.ima
top.left.menu.document.ima
}
}
Michel
ASKER
Yes i saw it allready Sorry stupit mistake, but it still
doesn't work .
The image in Menu.html stays the same nothing is changing.
I put an alert to check if the function gets the new image
and it does - but no change in the Menu frame.
Comments??
doesn't work .
The image in Menu.html stays the same nothing is changing.
I put an alert to check if the function gets the new image
and it does - but no change in the Menu frame.
Comments??
Please zip and send me the frameset, menu main and images
michel@irt.org
michel@irt.org
ASKER
Michel
Thank you it works great.
If you can just add the function here so I can
accept your comment as answer.
See Ya'
Ileen.
Thank you it works great.
If you can just add the function here so I can
accept your comment as answer.
See Ya'
Ileen.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if (!document.images) return
if (top.menu && top.menu.document.images['
top.menu.document.images['
}