Click to See Complete Forum and Search --> : Properties offsetLeft y offsetWidth


jmancallosa
08-05-2003, 04:29 AM
I´m using layers with DIV. Once I´ve drawn each layer I need, I want to know the value of the properties offsetLeft and offsetWidth in each layer. The problem is that sometimes I obtain the correct value, but sometimes I obtain NaN.
For example:
for (x=1; x<=numPaginas; x++)
{
posYCampo=<%=posLeyY%>+sumaPaginas;
document.write("<div name='campo"+num+"' id='campo"+num+"' style='position:absolute; font-family:Verdana; font-size:7pt; left:<%=posLeyX%>mm; top:"+posYCampo+"mm; <%if ancho>0 then%>width:<%=ancho%>mm;<%end if%> z-index:2'><p><%=leyendaCopia%></p></div>");

offsetLeft = eval("document.all('campo" + num + "').offsetLeft") * mm;
offsetWidth = eval("document.all('campo" + num + "').offsetWidth") * mm;
alert("offsetLeft="+offsetLeft+" offsetWidth="+offsetWidth);
num++;
sumaPaginas=sumaPaginas+<%=altoPag%>-(<%=margensup%>+<%=margeninf%>);
}

gil davis
08-05-2003, 08:50 AM
You are asking a lot by only posting server-side code.

Please post the results as they would appear at the client.