Bueno, este es el objeto que tengo:
Código:
El código que está marcado en rojo xD. Como hago para que despues pueda editar el left y el top del objeto usando this.posX y this.posY?function circle(radio, positionX, positionY)
{
this.ra = radio;
this.di = radio*2;
this.element = document.body.appendChild(document.createElement("div"));
this.element.style.position = "absolute";
this.element.style.left = positionX+"px";
this.element.style.top = positionY+"px";
this.element.style.width = radio*2+"px";
this.element.style.height = radio*2+"px";
this.posX = this.element.style.left; // <--- Como hago aca?
this.posY = this.element.style.top; // <--- Y aca xD
this.element.style.backgroundImage = "url(circle.png)";
}
Se hace llamando a una función? Como? Porque lo que se me ocurrió fue esto:
Código:
Pero como le digo que quiero el valor al cual lo estoy igualando? xDDDthis.posX = function(){
this.element.style.left = ???+"px";
}
Y cuando lo "piden", como hago para "return" el valor de parseInt(this.element.style.left)


