3 replies [Last post]
jamesmcclelland
Offline
newbie
Last seen: 15 years 44 weeks ago
Joined: 2004-11-25
Posts: 3
Points: 0

Gang,

I'm trying to make my web page change the text in a box by clicking a menu item. Sounds simple but I can't seem to do it.

This works in Explorer, but does nothing in FireFox. Why?:

<p>Click your mouse on one of the choices</p>
<TABLE>
<TR>
<TD WIDTH="200" HEIGHT="100">
<a href="" onMouseOver="InfoDisplayArea.innerHTML='First Message is about the first menu item'" >First Menu Item</a><BR>
<a href="" onMouseOver="InfoDisplayArea.innerHTML='Second Message is about the second menu item'">Second Menu Item</a><BR>
<a href="" onMouseOver="InfoDisplayArea.innerHTML='Third Message is about the third menu item'">Third Menu Item</a><BR>
</TD>

<TD WIDTH="400" HEIGHT="100">
<div id='InfoDisplayArea'></div>
</TD>
</TR>
</TABLE>

Is there an easier way to do this?

Tags:
jamesmcclelland
Offline
newbie
Last seen: 15 years 44 weeks ago
Joined: 2004-11-25
Posts: 3
Points: 0

Does .innerHTML not work in FireFox? It does in Explorer.

Woops, have to turn off html to show the example:

<p>Click your mouse on one of the choices</p>
<TABLE>
<TR>
<TD WIDTH="200" HEIGHT="100">
<a href="" onMouseover="InfoDisplayArea.innerHTML='<B>First Message</B> is about the first menu item'" >First Menu Item</a><BR>
<a href="" onMouseover="InfoDisplayArea.innerHTML='<B>Second Message</B> is about the second menu item'">Second Menu Item</a><BR>
<a href="" onMouseover="InfoDisplayArea.innerHTML='<B>Third Message</B> is about the third menu item'">Third Menu Item</a><BR>
</TD>

<TD WIDTH="400" HEIGHT="100">
<div id='InfoDisplayArea'></div>
</TD>
</TR>
</TABLE>

Is there a good forum to post this in?

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 2 weeks 3 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Does .innerHTML not work in FireFox? It does in Explorer.

Hi jamesmcclelland,
The problem is the way you are targeting "InfoDisplayArea" in the onmouseover.
try something like onmouseover="document.getElementById('InfoDisplayArea').innerHTML ='<B>First Message</B> is about the first menu item'"
That should work in most browsers with DOM support.

jamesmcclelland
Offline
newbie
Last seen: 15 years 44 weeks ago
Joined: 2004-11-25
Posts: 3
Points: 0

Does .innerHTML not work in FireFox? It does in Explorer.

Tony,

This has been very helpful. Here's what I have now:

<a href="workingdemo2d.htm" onMouseDown="document.getElementById('InfoDisplayArea').innerHTML ='<B>First Message</B> is about the first menu item'">First Menu Item</a><BR>

And it works. Except I need the text to stay there after the MouseDown event. Can you help with that? OnClick doesn't do it either.

James