Same project as my other thread, but a different problem. I don't know where to start...
Ok, I have a bunch of rooms where you can mouse over things and go places. Anyway, I want to change the text of a td or div when you mouse over and off of certain images.
e.g.
You mouse over the lamp and the td's text changes to "Lamp." You mouse off and the td goes blank again.
The only way I know how to do this is to make a bunch of divs that appear and disappear. Problem with that is It'd take a whole lot more coding and a bunch of divs laying around.
I need something like this:
onmouseover="appear('string');"
...
<td name="infobox">[blank until mouseover]</td>
[js] Change text in a td or div (easily)? ::solved::
Moderator: General Moderators
[js] Change text in a td or div (easily)? ::solved::
Last edited by Skara on Mon Sep 05, 2005 7:42 am, edited 1 time in total.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
function appear(text) {
document.getElementById('mbox').innerHTML = text;
}
function disappear() {
document.getElementById('mbox').innerHTML = '';
}
------
<div id="mbox"></div>
------
<a href="#" onmouseover="appear('I\'m supa-coo!');" onmouseout="disappear();">blah</a>