Forum Moderators: open

Message Too Old, No Replies

Multiple mouseover effects does not work.

         

fototex

6:59 pm on May 13, 2010 (gmt 0)

10+ Year Member



Hi webmasters,

I have been trying to achieve a multiple mouseover effect on some of my pictures within my web page.

The first effect changes the picture within a table - works fine
The second effect should change the text within another table. - does not work.

I am receiving the error message:
'document.text' is null or not an object.

Here is the code which lies on my image:


<td style="height: 101px; width: 20%" valign="top">
<img onMouseover="changeimage(myimages[1],this.href); newchange();" alt="loading" height="86" src="images/marsrover_sml.jpg" width="104" /></td>


Here is the newchange() script:


<script language="JavaScript1.1">
function newchange()
{
document.text.innerHTML='<b>hello world</b>'
}
</script>


And I am sure that the table in which the text should appear has its Id and Name defined as "text"

Here is it:


<td class="style5" Id="text" name="text" style="height: 29px; width: 525px" valign="top">
<strong class="style10">Endavour has launched</strong></td>


But could not make it work error free.
Thanks for any comments.

Fotiman

7:11 pm on May 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



document.text does not exist. You must use document.getElementById('text') to get the element that has id 'text'.

function newchange() {
document.getElementById('text').innerHTML='<b>hello world</b>';
}

fototex

7:41 pm on May 13, 2010 (gmt 0)

10+ Year Member



Hi Fotiman,

Tried this and worked great! :)

Thank you very much for your support!