View Full Version : Arggggh.... am I seeing things?!

03-28-2007, 02:37 PM

Here it is: I set the position of a div dynamically, it flips the directions.

You would think it would be a case of swapping the co-ordinates assigned, but no.

Does anyone know what I'm doing wrong?

var el = document.getElementById("startDiv");
if(debug){document.getElementById("debugText").value +="Start at"+el.style.left+","+el.style.top+"\n"}
el.style.top = parseInt(pos_f_y2*(this.tileSize+this.tileSpacing))+"px"
el.style.left = parseInt(pos_f_x2*(this.tileSize+this.tileSpacing))+"px"
if(debug){document.getElementById("debugText").value +="Start at"+el.style.left+","+el.style.top+"\n\n"}
//if(debug){document.getElementById("debugText").value +="Z:"+el.style.zIndex+"\n"}
this.startTileX = pos_f_x2;
this.startTileY = pos_f_y2;
return true;

I've just added part of the code. If you need to see the whole thing, just ask, and I'll upload it.


03-28-2007, 02:57 PM
i add the div dynamically too with

if (document.getElementById && !document.all)
rng = document.createRange();
el = document.getElementById("mapDiv");
htmlFrag = rng.createContextualFragment(temp_string);
while (el.hasChildNodes())

Would that affect the divs ability to move correctly?

03-28-2007, 03:15 PM
Hey bob90 :), please tell me what you want as I am confused, if you want me to make what you tell me to just say the word....

03-28-2007, 03:50 PM
I will try to sort it tonight.

I get an element, change its top and left position and it doesn't work.
They get flipped for some reason.
I can see this with the debug code and the div onscreen.

03-28-2007, 03:59 PM
Ok :)