|
|
| hey, I want to be able to change text to an image when the user puts thier mouse over it, is this possible without using another image instead of text?? Anyone know how? |
| There's a couple ways to do it, one would be to use the onmouseover event on a div containing the text, then use .innerHTML to change the contents of the div to an image, and back again for the mouseout. |
| could you give me a sample code possibly?? I'm still a bit confused. |
| This is about a medium complex way to do it. This goes in the HEAD: Code: <script type="text/javascript"> function swapimg(d,i) { this.innerHTML = '<img src="' + i + '" />'; } function swaptext(d,s) { this.innerHTML = s; } </script> This in the BODY: Code: <div id="d1" onmouseover="swapimg('d1','myimage.gif');" onmouseout="swaptext('d1','Something');">Something</div> |