Forum Moderators: open

Message Too Old, No Replies

FF & Safari cant see the DIVs created by AJAX!

gettin DIV position works if it wasnt created by AJAX

         

smagdy

1:27 pm on Jun 26, 2007 (gmt 0)

10+ Year Member



Hello!
I hope someone can clear this, i am sure it just need a 1 word or something to work!

This function gets the X & Y of the any element which is in my case a DIV and it works fine cross browsers!

The problem is that it doesnt work in FF & Safari when the DIV is populated by AJAX.. i don't know it doesnt see the new DIVs or what is it.. but the obj is passed to it correctly for sure and it works gr8 in IE6 & 7

How to tweak it to see the new DIVs created by AJAX?

function findPos(img,obj) {

var curleft = curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
alert(curtop);

}

Thanks in advance

colandy

10:25 am on Jun 27, 2007 (gmt 0)

10+ Year Member



Had a similar issue with the left and top attributes in FF previously. Not sure if this is the same as your problem but the solution to my issue was the doctype tag. I had to remove the "http://......." part and all worked fine.