Click to See Complete Forum and Search --> : Mouseover changing text in another cell
andersoni
07-23-2003, 11:36 PM
OK, being new to mouseovers, I have managed various image mouse overs but now I need the text in a different cell to change when an image has the mouse over.
Something like,
document.idofcell.value="text to display"
or
document.idofcell.text="text to display"
Also, since getting more involved with javascript, where is a good resource to find out about the properties and methods of various objects. In otherwords, how can I find out that it has to be document.idofcell.value versus, document.idofcell.text (as examples) it is the property of the cell, or image, or font or whatever that I am looking for.
Thanks.
Ian
Exuro
07-24-2003, 12:03 AM
By "cell" I'm assuming you're talking about tables. Try this:
document.getElementById(idOfCell).innerHTML = "Text to display."
As far as properties goes, I like W3Schools.com's DHTML section:
http://www.w3schools.com/dhtml/default.asp
They don't seem to have the .innerHTML property though...
Tamango
07-24-2003, 03:14 AM
I'm new to JavaScript, I've found a tutorial how to to make a picture appear in a table cell when I mouse over on a link. Now I would like to do with text (as mentioned aby andersoni). I have no idea where to include the
document.getElementById(idOfCell).innerHTML = "Text to display"
My code with image (last part) looks like this
eval("document['picture'].src = " + picimage + ".src");
I tried to substitute them but I don't know how.
Exuro
07-24-2003, 02:26 PM
Stick the document.getElementById(idOfCell).innerHTML = 'Text to display' inside your onMouseOver for your link, and then put document.getElementById(idOfCell).innerHTML = ' ' or something like that in the onMouseOut of your link.
Tamango
07-24-2003, 06:49 PM
Exuro I'm sorry, but I'm looooooost. This is what my HEAD script looks like:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var char = new Image();
char.src = "D:/Web/JavaScript Source/thumbnail.txt";
function doButtons(picimage) {
eval("document['picture'].src = " + picimage + ".src");
}
// End -->
</script>
I think i have to change the function doButtons... so that
document.getElementById(idOfCell).innerHTML = 'Text to display'
will work in the BODY.
Exuro
07-24-2003, 08:37 PM
Yeah, just change eval("document['picture'].src = " + picimage + ".src"); to document.getElementById(idOfCell).innerHTML = 'Text to display' and it should work ok. But, you need to be sure to pass in the cell's ID instead of the picture name wherever it's called at...