Hello
Using VB I can make a butterfly move/fly..an"openwinged..a closedwinged" then they fly...My question is that How can do the same using" java script"Can we make things move/fly to all directions. in JavaScript"
thanks
Printable View
Hello
Using VB I can make a butterfly move/fly..an"openwinged..a closedwinged" then they fly...My question is that How can do the same using" java script"Can we make things move/fly to all directions. in JavaScript"
thanks
Yes, you can. Heres some sample code which I use to get and set positions of objects in an HTML document.
Heres an example of how to use it.
Whar happens is when you move the mouse over the image it moves it 10 pixels to the left. You can replace left with top.Code:<div id="image1.gif" onmouseover="findDom('image1').style.left=findleft('image1')-10"><img src="image1.gif"></div>
Code:function findleft(objectID){
if (findDom(objectID).left){return findDom(grandfather).left;}
if (findDom(objectID).pixelLeft){return findDom(grandfather).pixelLeft;}
if (findDom(objectID).offsetLeft){return findDom(grandfather).offsetLeft;}
return 'null';
}
function findtop(objectID){
if (findDom(objectID).top){return findDom(grandfather).top;}
if (findDom(objectID).pixelTop){return findDom(objectID).pixelTop;}
if (findDom(objectID).offsetTop){return findDom(objectID).offsetTop;}
return 'null';
}
function findDom(objectID){
if (document.all){
return document.all(objectID);
} else if (document.getElementById){
return document.getElementById(objectID);
} else if (document.layers){
return (document.layers[objectID]);
}
}