manutdfan
03-02-2009, 05:19 PM
Like the title says I have got an onMouseOver event working, however when I validate the page it fails stating that <a> tags do not have this event, it also doesn't like the onMouseOut part and the name bit in the <img> tag.
The main reason I am doing this is to pass to a small javascript piece which replaces the image when moused over and return it back to normal when the mouse has disappeared. I am trying to code within the standards but I cannot find any examples of such code on the w3c website.
thanks
<a href="/index.html" onMouseOver="sel('home')" onMouseOut="notSel('home')">
<img src="/images/home.png" alt="Homepage" class="sidebar" name="home"/>
</a>
function sel(name)
{
document.images[name].src = "/images/" + name + "Sel.png";
}
function notSel(name)
{
document.images[name].src = "/images/" + name + ".png";
}
The main reason I am doing this is to pass to a small javascript piece which replaces the image when moused over and return it back to normal when the mouse has disappeared. I am trying to code within the standards but I cannot find any examples of such code on the w3c website.
thanks
<a href="/index.html" onMouseOver="sel('home')" onMouseOut="notSel('home')">
<img src="/images/home.png" alt="Homepage" class="sidebar" name="home"/>
</a>
function sel(name)
{
document.images[name].src = "/images/" + name + "Sel.png";
}
function notSel(name)
{
document.images[name].src = "/images/" + name + ".png";
}