I just have the code Caleb gave me.
Printable View
I just have the code Caleb gave me.
Then echo the variables by using document.write as shown.
Code:var x;
var y;
var element;
element = $('elementName');
x = element.offsetLeft;
y = element.offsetTop;
document.write(x);
document.write(y);
The variables are stored in x and y.. that's how you access them..
Alright, thanks. How would I turn them into a PHP variable?
You've got to get them to PHP first.. which would be an AJAX Request.. and since you're using Prototype, just use Ajax.Request.
Could do something like this (messy but yeah)
Code:document.write("<a href='save.php?x=" + x + "&y=" + y + "'>Save your co-ords!</a>");
Thanks Robbie and Caleb, I know what to do now.