Steve K

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromSteve K
ToMe
SubjectHi, I need help....
Date25 February 2004 06:11
Hello,
I gotta problem that should work but doesnt. U write in your tutorial

from there, you can reference items inside that document using
document.whatever . . .
eg. parent.frames.otherframename.document['imagename'].src = "pig.gif";

that works great in Mozilla but IE flares an error on this code line 'not
an object'
The stumble stone seems to be the document['imagename'] which IE6 seems not
to like.
When i put it in IE6 jargon like this:
 parent.frames.otherframename.imagename.src = "pig.gif";

it works in IE6 but not in Mozilla! Is there a way to make it working in
both browsers(same code)??


Thx for help

Steve
FromMe
ToSteve K
SubjectRe: cross frame image swapping
Date25 February 2004 08:18
Steve,

Just tested it all to make sure. It works fine for me. It looks like you
might have got caught up by browser security models. The second example you
have given is completely invalid, and even though it does seem to work in
IE and Opera, that is no excuse to use it. So I intend to find out why the
correct syntax did not work for you.

Can you send me a url of your page so I can see the problem for myself?

Cheers


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/


PS. 'Hi, I need help...' was a poor choice of subject. Your email very
nearly got deleted as spam
FromSteve K
ToMe
SubjectRe: cross frame image swapping
Date25 February 2004 11:08
This is the URL
http://xxxxx.xxxxxxx.xxx.xx/xxxxx/Start.html 

but I am afraid it is the working but completely invalid code :)

here a clip were the code is used:
<AREA SHAPE="rect" COORDS="115,46,160,108" HREF="javascript:nothing()"
title="Northern Territory" onmouseover=parent.PanelRight.img7.src=ButOn
onmouseout="parent.PanelRight.img7.src='NT-Button.gif'">
<AREA SHAPE="rect" COORDS="177,73,232,111" HREF="javascript:nothing()"
title="Queensland" onmouseover=parent.PanelRight.img8.src=ButOn
onmouseout="parent.PanelRight.img8.src='QLD-Button.gif'">

When u r on my site u see an Australia map in the middle of the page - hover
over the state's name and see the button swapping (right panel)...but works
only in IE only.
FromMe
ToSteve K
SubjectRe: cross frame image swapping
Date25 February 2004 11:40
Steve,

I know why it doesn't work. Your HTML is invalid.

Put the onmouseover event handlers in quotes properly. You are confusing
the poor browsers, because they don't know which = sign belongs to the HTML
and which belongs to the JS. When you add ' quotes into it, you just
confuse them even more.

This is valid code (note the " quotes surrounding the JavaScript - you have
not put on your page):

onmouseover="parent.frames['PanelRight'].document.images['img7'].src=ButOn;"

Put that in and it should work properly in all browsers from Netscape 3
upwards.

Just as a warning, you have a duplicate frame name bug in your frameset.
Two frames are called 'corner' - you might want to try my frameset
structure parsing script:
http://www.howtocreate.co.uk/jslibs/script-frametree
which is also available for your context menu (except your page blocks
context menus)
http://www.howtocreate.co.uk/tutorials/jsexamples/contextmenu/

Tarquin
FromSteve K
ToMe
SubjectRe: cross frame image swapping
Date25 February 2004 11:46
Just got the answer in the dom newsgroup - this code is x-browser
compatible:
onmouseover="parent.PanelRight.document.getElementById('img3').src=ButOn"

The getElementById('img3') is doing the trick - no more 'not an object'
error in IE!

Mission accomplished..

thx for assistance - uploaded already the new code and works fine!
FromSteve K
ToMe
SubjectRe: cross frame image swapping
Date25 February 2004 11:48
> onmouseover="parent.frames['PanelRight'].document.images['img7'].src=ButOn;"


Thx Mark - had this syntax already and it flared in IE (not an object)
See my other mail to u! The problem is fixed now! Thx for the double-name
warning..will fix it morrow! Late here..

night, night

greetings from Brisbane!
FromMe
ToSteve K
SubjectRe: cross frame image swapping
Date25 February 2004 11:49
but as I said, that is not the problem. The problem is you are missing the
quotes.

getElementById will not work in IE 4, Netscape 4, WebTV, OmniWeb 4.2-,
Escape or Clue. What I sent you will.

It's not a real problem, because those browsers are not in common use now.
FromSteve K
ToMe
SubjectRe: cross frame image swapping
Date25 February 2004 21:07
Hello Mark,
Yes ur right DOM( getElementById ) is only in newer browsers supported. I am
going to change my syntax today and see how it works for me..

Thx for assistance - very much appreciated!

Ste.
FromSteve K
ToMe
SubjectRe: cross frame image swapping
Date25 February 2004 21:28
Changed my 'corner' double-naming in the framsets and the x-frame syntax
(parent.frames['PanelRight'] etc.)  Everything is still working fine in both
browsers - all done!

St.
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.