Hope someone can help,
Thanks
|
Newbie Member
|
|
| 7Dec2009,17:55 | #1 |
|
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
|
|
Go4Expert Founder
|
![]() |
| 7Dec2009,18:17 | #2 |
|
All you are trying to do is store some numbers in a file and what makes you think it cannot be done.
|
|
Newbie Member
|
|
| 7Dec2009,21:34 | #3 |
|
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 |
|
Ambitious contributor
|
![]() |
| 8Dec2009,00:03 | #4 |
|
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; |
|
Newbie Member
|
|
| 9Dec2009,22:37 | #5 |
|
This is quite usefull, how would one submit this into a form textarea when the form is submitted?
|
|
Ambitious contributor
|
![]() |
| 9Dec2009,23:01 | #6 |
|
Create a javascript which takes the above two values as arguments. Inside the function, use:
Code:
// here 'txtarea' inside brackets is the ID set for the textarea tag
txtarea = document.getElementbyId('txtarea');
txtarea.value = x + " " + y;
|