Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving a graphic in Javascript

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Basicly that's it. I wish to move a graphic that is 734w by 1h. I wish to move it up and down. Like it is scanning. I also wish it to stay in a certain spot, at the top of my page. Like in a table. Any help you could give would be nice.

Thanks
 
<!-- here a way to move objects -->
<html>
<head>
<style>
<!--
.drag{position:relative;cursor:hand}
-->
</style>
<script language=&quot;JavaScript1.2&quot;>
<!--

var dragapproved=false;
var z,x,y;

function move(){
if (event.button==1&&dragapproved) {
z.style.pixelLeft=temp1+event.clientX-x;
z.style.pixelTop=temp2+event.clientY-y;
return false;
}
}

function drags() {
if (!document.all){return;}
if (event.srcElement.className==&quot;drag&quot;) {
dragapproved=true;
z=event.srcElement;
temp1=z.style.pixelLeft;
temp2=z.style.pixelTop;
x=event.clientX;
y=event.clientY;
document.onmousemove=move;
}
}

document.onmousedown=drags;
document.onmouseup=new Function(&quot;dragapproved=false&quot;);
//-->
</script>
</head>
<body bgcolor=&quot;white&quot;>
<center>
<br><br><br><br><br><br>
<img src=&quot;img/test.gif&quot; class=&quot;drag&quot;>
<br><br><br><br><br><br>
<img src=&quot;img/test2.gif&quot; class=&quot;drag&quot;>
</center>
</body>
</html>
---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Thanks for the Script, but I mean more like moving by it's self. Like a big .gif or a flash animation. I guess this is more in DHTML like stuff.
 
first thing first DHTML dosen't exist
it a way of saying &quot;cross-browser-dinamic*-html&quot;
* using javascript vb css etc...

just to move objects ...
check out xutopia site for examples (like this one ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top