Forum Moderators: open
Let's say I include an iFrame tag in my page which loads a webpage in it. Now let's say I want to add a div in a page which is loaded in iframe. Now I would like to save cordinates of DIV and other properties somewhere in DB. Now I want to know that whether cordinates of DIV will change if I load same page without iFrame?
I want to make an application which will load the website in iFrame then I will add few divs(draggable) on any position of website which is loaded in iframe. The thing is that I don't know how to find out the position of DIV within iframe so that I load same coordinates when it's loaded without iframe. Is it possible to find out coordinates relative to iFrame?
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}