javascript rollover image - (how) can I set css styles for onmouseover image? -
newbie here pls patient :)
i have image (image#1) aligned against far left of page (all body padding , margins set 0) , have added rollover javascript new image (image#2) appears in place on mouseover. image#2 larger image#1.
at moment, on mouseover image#2 appears not aligning far left against page (the default page margins seem have been re-introduced , body css rules ignored).
is there anyway of applying id image#2 can control css styles it? or other way of removing margin appears on mouseover? 2 images overlap @ far left corner.
help appreciated. thanks!
<head> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> </head> $('img#id').mouseover(function(){ $(this).css("property","value"); });
it requires jquery..
//////////////////////////////////////////////////////////////////////////////////////
var elem = document.getelementbyid("id"); //your img id passed in here elem.onmouseover= function(){ this.style.yourpropertiesincamelcase = "value"; }
////////////////////////////////////////////////////////////////////////////////////// p.s.: can google camelcase if don't know is... careful css properties in "pure" javascript. there possible browser inconsistencies... code can become not crossbrowser...
Comments
Post a Comment