Forum Moderators: open

Message Too Old, No Replies

Questions regarding Iframe

         

kadnan

4:14 pm on Oct 3, 2008 (gmt 0)

10+ Year Member



I need to know few questions regarding iframe functionality.

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?

StoutFiles

6:24 pm on Oct 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could...you know...test it yourself.

kadnan

8:41 am on Oct 12, 2008 (gmt 0)

10+ Year Member



Ok a related question and bit more in detail.

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?

adaptor40

11:20 am on Oct 16, 2008 (gmt 0)

10+ Year Member



i have been using this functions for finding position around my textboxes to place div and then iframe
X give u left and Y gives you top of the object...hope this helps

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;
}