pbusig
New Coder
I have been working on re-learning Javascript and am currently trying to use onmouseover and onmouseout to change a photo in my page to another photo, So far I have had no luck. When I open my page it does not load my photo, it loads the alternate text, so I know that this part of the code is not working correctly, and when I mouseover the alternate text the photo changes to the second photo, however when I mouseout it does not change back. I know this is probably a lame question to have to ask and that I should be ashamed to not get this figured out for myself, so please forgive me. Here is my Code:
This is the code from my html page:
<img id="demo4" onmouseover="Melanie(this)" onmouseout="Kiki(this)" border="0" src="/images/Kiki.jpg" alt="Kiki" width="32" height="32">
These are my functions from my myscript.js file:
function Melanie(x) {
document.getElementById("demo4").innerHTML = "<img src= images/Melanie.jpg>";
}
function kiki(x) {
document.getElementById("demo4").innerHTML = "<img src= images/Kiki.jpg>";
This is the code from my html page:
<img id="demo4" onmouseover="Melanie(this)" onmouseout="Kiki(this)" border="0" src="/images/Kiki.jpg" alt="Kiki" width="32" height="32">
These are my functions from my myscript.js file:
function Melanie(x) {
document.getElementById("demo4").innerHTML = "<img src= images/Melanie.jpg>";
}
function kiki(x) {
document.getElementById("demo4").innerHTML = "<img src= images/Kiki.jpg>";