Javascript question to move image forward and back?

Discussions for using Jaxer and JavaScript on the Cloud

Javascript question to move image forward and back?

Postby jeena1 » Tue Mar 17, 2009 6:23 am

Hi....

What is the javascript code to move image forward when onmouseover and move image back to its original position when onmouseout? I tried searching for it but it seems like its nowhere to be found. Hopefully someone will be able to help. Thanks.

___________________

T shirt Embroidery
Seo services
jeena1
 
Posts: 2
Joined: Tue Mar 17, 2009 6:22 am

Re: Javascript question to move image forward and back?

Postby sircambridge » Sat Jun 13, 2009 9:34 am

maybe

document.getElementById('imgid').onmouseover=function(){this.style.top='5px'}
document.getElementById('imgid').onmouseout=function(){this.style.top='0px'}

or, just use jquery, the solution to everything javascript :)
sircambridge
 
Posts: 12
Joined: Fri Aug 29, 2008 5:47 am

Re: Javascript question to move image forward and back?

Postby macwilson » Thu Oct 01, 2009 9:48 am

<script language="JavaScript">

Hmove=-100;
function moveObjRight(obj)
{
obj.style.left=Hmove;
Hmove+=2;
if(Hmove<100)
window.setTimeout("moveObjRight(" +obj.id+ ");", 0);
}

</script>
<p><img id=JS style="z-index: 0; left: -100px; position: absolute; top: 50px"
height=32 width=101 align=baseline border=0 hspace=0 src="JavaScript.gif"></p>
<p>
<script language="JavaScript">
moveObjRight(JS);
</script>
</p>
This is the script. This may help you.
macwilson
 
Posts: 1
Joined: Thu Oct 01, 2009 9:28 am


Return to Jaxer and JavaScript on the Cloud