Help! Javascript DOM problem

M

Mr Pixie

I hope someone can help me fix this - I just can't understand why it is not
working:

I have this frameset:

<frameset rows="89,*,50" cols="*" framespacing="0" frameborder="NO"
border="0">

<frame src="Navigation/Navigation.htm" name="topFrame" scrolling="NO"
noresize>
<frame src="Homepage/Homepage.htm" name="mainFrame" scrolling="NO"
noresize>
<frame src="HotNews/Hotnews.htm" name="bottomFrame" scrolling="NO"
noresize>

</frameset>


mainFrame contains an image that I want to flip and an IFrame.
In the IFrame, there are buttons that, when clicked, should change the image
I just mentioned, which is in the mainFrame.

When the button in the IFrame is clicked, it runs a function containing this
line of code:

mainFrame.document.flipForm.flip.src=ImageButtonName;

which should work, because I know it does when I try it from a button within
mainFrame (obviously, dropping the the mainFrame. part).

For some annoying reason, the when the button in the IFrame is clicked it
does not swap the image in the mainFrame. Help!!
 
D

dd

I hope someone can help me fix this - I just can't
understand why it is not working:
mainFrame.document.flipForm.flip.src=ImageButtonName;

You didn't say how it's not working. Do you get a JavaScript error?
I'll assume it's not a cross-domain error. Maybe it's just the scope
of the ImageButtonName variable. Perhaps this would fix it:

mainFrame.document.flipForm.flip.src=mainFrame.document.ImageButtonName;
 
M

Mr Pixie

dd said:
You didn't say how it's not working. Do you get a JavaScript error?
I'll assume it's not a cross-domain error. Maybe it's just the scope
of the ImageButtonName variable. Perhaps this would fix it:

mainFrame.document.flipForm.flip.src=mainFrame.document.ImageButtonName;

There is no Javascript error, it just won't flip the image in the parent
frame.

In this line:
mainFrame.document.flipForm.flip.src=ImageButtonName;

The ImageButtonName on the RHS is fine, I can verify that it is definately
getting that ok (by showing it in an alert). The problem is getting the LHS
right...
 
D

dd

The ImageButtonName on the RHS is fine, I can verify that it is definately
getting that ok (by showing it in an alert). The problem is getting the LHS
right...

top.document.frames["mainFrame"].document.getElementById("flip").src=ImageButtonName;

?
 

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

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top