Does anyone know how to store the coordinates of a draggable image in a .txt file, to allow the same image to be re-loaded in the same position on another page? Hope someone can help, Thanks :pleased:
I know it can be done, and i know that i need to use GetElementById, e.clientX, and e.ClientY. But im new to this and just wanted some advice of how to go about it. Thanks
But the clientx and clienty gives the current mouse position and not the image's position on a screen. You can do as follows: Code: var x = document.images.imagename.offsetLeft; var y = document.images.imagename.offsetTop;
Create a javascript which takes the above two values as arguments. Inside the function, use: Code: // here '[COLOR="Blue"]txtarea[/COLOR]' inside brackets is the ID set for the textarea tag txtarea = document.getElementbyId('[COLOR="blue"]txtarea[/COLOR]'); txtarea.value = x + " " + y; Then in the onlcick event of the submit button, call this function.