Hola, gracias por responder, pero no sé si esa es la causa.
La variable
cuadro1 referencia un elemento <div>. De todas formas he probado por si acaso...pero no :(
De todas formas he cambiado la estrategia. En lugar de crear un objeto/array, estaba intentando crear una pseudoclase. (mas bien una función que pseudoclase...), pero no consigo que me retorne los valores.
Así:
Código:
function cuadro(cadena) {
var cuadro1 = document.getElementById(cadena);
var top = document.defaultView.getComputedStyle(cuadro1, '').getPropertyValue('top');
var left = document.defaultView.getComputedStyle(cuadro1, '').getPropertyValue('left');
var width = document.defaultView.getComputedStyle(cuadro1, '').getPropertyValue('width');
var height = document.defaultView.getComputedStyle(cuadro1, '').getPropertyValue('height');
var limiteX= parseInt(top)+parseInt(height);
var limiteY= parseInt(left)+parseInt(width);
console.log(limiteX); //<-----Aqui va bien. Se muestra el valor
function muestraX()
{
return limiteX;
}
};
Ahora el problema es que no me devuelve los valores
Código:
var casilla = new cuadro("Cuadro1");
console.log(casilla.muestraX);//<----Aqui muestra indefinido