Closed Thread Icon

Topic awaiting preservation: Retrieve Frame size inside iframe. Pages that link to <a href="https://ozoneasylum.com/backlink?for=8468" title="Pages that link to Topic awaiting preservation: Retrieve Frame size inside iframe." rel="nofollow" >Topic awaiting preservation: Retrieve Frame size inside iframe.\

 
Author Thread
Sam
Bipolar (III) Inmate

From: Belgium
Insane since: Oct 2002

posted posted 01-17-2003 15:13

Dears,

I'm wondering how I can retrieve the width and height of an iframe from the html page inside the iframe?

I thought this would work but I get the value <undefined>?

code:
w = parent.document.frames([i]<framename>[/i]).width;
h = parent.document.frames([i]<framename>[/i]).height;



What am I doing wrong?

Sam

Hugh
Paranoid (IV) Inmate

From: Dublin, Ireland
Insane since: Jul 2000

posted posted 01-17-2003 15:58

mmh, maybe just use square brackets [ ] where you have rounded ones. (..frames[].sdfas or frames.name.fsd)

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 01-17-2003 17:48

Maybe even just: parent.frames["nameValue"].width

But if what you say is true then you shouldn't be using parent... Parent is to refer backwards or up in the frame hirechy, you want to move down/forwards.

Try this: frames[0].frames[0].height

Given that you only have 1 iframe in each document, otherwise you'll need to use the frame's name value.

Just remember that you should set both an "ID" and "NAME" attribiutes for the iframe as Mozilla doen't use the ID in the frames[] object, only the NAME value.

Although you could also get it through it's style values: frames["nameValue"].document.getElementById("idValue").style.width

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 01-17-2003 17:56

When I get lost like this (in terms of the "parent" attribute) I like starting from the "top"

top.document.frames[<framename>].width;




.:[ Never resist a perfect moment ]:.

enoctis
Obsessive-Compulsive (I) Inmate

From: Atlanta, GA - USA
Insane since: Dec 2003

posted posted 12-20-2003 18:46

you're using a frame name instead of a frame id. the code below will retrieve the document length from within an iframe (dynamIframe is the iframe id)

document.getElementById("dynamIframe").body.scrollHeight
document.getElementById("dynamIframe").document.body.scrollHeight

It's one of those 2.

-os2

Alevice
Paranoid (IV) Inmate

From: Mexico
Insane since: Dec 2002

posted posted 12-20-2003 23:57

you seem so kind on answering those questions, but these threads are damn fucking old, and probably the oerson who asked does not visit this place anymore.

__________________________________


Sexy Demoness cel

« BackwardsOnwards »

Show Forum Drop Down Menu