...

View Full Version : Move a picture on page by submitting its coordinate



lady
02-07-2007, 06:02 PM
Hi Guys) Can u suggest me a Jsimple avaScript+CSS for moving an image on the page according to the submitted coordinates in FORM, e.g if I put 60 in Xinput and 100 in Yinput push Submit and a picture will go to that position.
What model to use...? pixelTop and pixelLeft and how? any ideas...:( please)
p.s without php.
Thanks a lot

Mr J
02-07-2007, 07:14 PM
Try something like this


<script type="text/javascript"">

function movePic(){

newLeft=document.getElementById("xinput").value
newTop=document.getElementById("yinput").value

document.mypic.style.left=newLeft+"px"
document.mypic.style.top=newTop+"px"


}
</script>


<img name="mypic" src="pic.jpg" style="position:absolute;left:100px;top:100px">

<input type="text" id="xinput">
<input type="text" id="yinput">
<input type="button" value="Move Pic" onclick="movePic()">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum