Tuesday, 27 August 2013

innerHTML with getElementByClassName doesn't work

innerHTML with getElementByClassName doesn't work

This one works:
<td onmouseover="document.getElementById('textbox').innerHTML='Hidden
text'" onmouseout="document.getElementById('textbox').innerHTML='Show
text'">
<div id="textbox">Show text</div>
</td>
But this one doesn't:
<td
onmouseover="document.getElementByClassName('textbox').innerHTML='Hidden
text'"
onmouseout="document.getElementByClassName('textbox').innerHTML='Show
text'">
<div class="textbox">Show text</div>
</td>
How can I fix this? I need a class to use it more than once.

No comments:

Post a Comment