Take the 2-minute tour ×

How can you add width/height inside the command onmouseover? example:

onMouseOver="if (document.images) document.getElementById('Image-Maps_3201302221606237').src= 'images/rhs2.png';"
onMouseOut="if (document.images) document.getElementById('Image-Maps_3201302221606237').src='images/high_schools.gif';">

When the mouse goes over a certain element, i need the image being displayed to have a certain width or height?

OK to give you a more clearer picture of what i am trying to accomplish, i have a picture that is static with different icons on it, each icon has a link on it based on coordinates it takes from the image, i want that when the mouse goes over the certain coordinates on the map for a the icon to get bigger or another image appear on top of the coordinates that is a little bit bigger than the icon on the static image so that it creates the effect that its making it bigger and when mouse goes out it dissapears the new picture, here is the code


share|improve this question
What have you attempted to accomplish what you're asking? –  Jesse Feb 28 '13 at 0:26
add comment

1 Answer

After .src='images/rhs2.png add

document.getElementById('the-id').style.height = certainHeight;

Do something similar for width.

I'd also strongly advise that you drop the on event attributes and use JavaScript for binding instead:

    'mouseover', function () {

    this.src = newSrc;
    this.style.height = certainHeight;
    this.style.width = certainWidth;
share|improve this answer
read my discription again i updated with more info, it doesnt work –  user2117631 Feb 28 '13 at 0:37
i added a example file and shared it, i hope it helps you understand in what im trying to do so you can help me. –  user2117631 Feb 28 '13 at 0:43
it doesnt work? i added more info in the discription about the problem –  user2117631 Feb 28 '13 at 22:58
add comment

Your Answer


