Resizing frames with firefox

J

jeanor72

Hi all,

I'm trying to fix some javascript code to make it work also with
firefox.
I have the following function in a href link in a frame used to make
another frame ("uno") visible or invisible.

--- start here --
function resizeMenu() {
var stretto = '0%,100%';
var largo = '20%,80%';
if ( window.parent.uno.cols == largo ) {
window.parent.uno.cols=stretto;
} else {
window.parent.uno.cols=largo;
}
document.location.reload();
}
--- end here ---

This works with MSIE, but doesn't with firefox.

I read a lot over the internet, but didn't find anything useful to make
the function also works for firefox.

Note that Firefox console tells me:

"Errore: window.parent.uno has no properties"

But I don't know what to do to fix this.

Can anybody help me please?

Thank you,
Gianluca
 
M

Martin Honnen

jeanor72 said:
if ( window.parent.uno.cols == largo ) {
window.parent.uno.cols=stretto;
} else {

Note that Firefox console tells me:

"Errore: window.parent.uno has no properties"

Use e.g.
var frameSet = parent.getElementById('uno');
if (frameSet != null) {
if (frameSet.cols == largo) {
frameSet.cols = = stretto;
}
else {
frameSet.cols = largo;
}
}
 
A

ASM

jeanor72 a écrit :
Hi all,

I'm trying to fix some javascript code to make it work also with
firefox.
I have the following function in a href link in a frame used to make
another frame ("uno") visible or invisible.

--- start here --
function resizeMenu() {
var stretto = '0%,100%';
var largo = '20%,80%';
if ( window.parent.uno.cols == largo ) {
window.parent.uno.cols=stretto;
} else {
window.parent.uno.cols=largo;
}
document.location.reload();
}
--- end here ---

This works with MSIE, but doesn't with firefox.

This would work everywhere (except NC4 IE4)

<html>
<script type="text/javascript">
function resizeMenu(sinistra,destra)
{
var attr = sinistra+'‰,'+destra+'‰';
document.getElementById("general").setAttribute('cols',attr);;
}
</script>
<frameset id="general" cols="20%,80%">
<frame id="leftFrame" src="menu.htm">
<frame id="rightFrame" noresize scrolling="no" src="frame_a.htm">
</frameset>
</html>

file 'frame_a.htm' :

<html>
<a href="#" onclick="top.resizeMenu(0,100);return false;">hide menu</a>
<a href="#" onclick="top.resizeMenu(20,80);return false;">show menu</a>
Note that Firefox console tells me:

"Errore: window.parent.uno has no properties"

or you didn't give 'uno' as *name* for your frameset
or frame 'uno' isn't in parent's frame where you call your function
or FF doesn't like direct JS commands about its frames

I vote for case 1 (you did give an id instead a name to your frameset)
 
J

jeanor72

Hi Martin,

thank you for your answer.
Use e.g.
var frameSet = parent.getElementById('uno');

I tried this. It doesn't work and firefox console says:

"Errore: parent.getElementById is not a function".

Note that this way doesn't work even with msie.

Gianluca
 
J

jeanor72

Martin said:
My bad, should of course be
var frameSet = parent.document.getElementById('uno');

It works!

Thank you very very much!
Thanks also to ASM.
Your help has been very appreciated.

Gianluca
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top