473,287 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

IFRAME autosizes and DIV autoload.

In Mozilla, the following code seems to resize correctly the IFRAME,
so no scroll bars:

<iframe marginwidth=0 marginheight=0 src=text.html
onload="this.height=
this.contentDocument.height">
</iframe>

Of course a frameborder=0 can be desiderable too :-)

Also, the same trick simplifies DIV loading:

<div id=pie></div>
<iframe
onload="document.getElementById('pie').innerHTML=
this.contentDocument.body.innerHTML"
scrolling=no width=100% height=1% frameborder=0 style="visibility:hidden"
src=text.html>
here the this.innerHTML, which is not transferred
</iframe>

Regretly, the onload tag does not work in konqueror.
Jul 20 '05 #1
3 18662
> <iframe marginwidth=0 marginheight=0 src=text.html
onload="this.height=
this.contentDocument.height">
</iframe>
I get

Error: uncaught exception: Permission denied to get property HTMLDocument.height

when trying this with Mozilla (?)

Love to see it work though...

alejandro.rivero wrote: In Mozilla, the following code seems to resize correctly the IFRAME,
so no scroll bars:

<iframe marginwidth=0 marginheight=0 src=text.html
onload="this.height=
this.contentDocument.height">
</iframe>

Of course a frameborder=0 can be desiderable too :-)

Also, the same trick simplifies DIV loading:

<div id=pie></div>
<iframe
onload="document.getElementById('pie').innerHTML=
this.contentDocument.body.innerHTML"
scrolling=no width=100% height=1% frameborder=0 style="visibility:hidden"
src=text.html>
here the this.innerHTML, which is not transferred
</iframe>

Regretly, the onload tag does not work in konqueror.

--
-------------------------------------------------------------
ninth ave p: +61 7 3870 8494
_ _ _ m: +61 405 048 371
__(@)< __(@)> __(@), w: http://www.ninthave.net
\___) \___) \___) e: r.*****@ninthave.net
-------------------------------------------------------------

Jul 20 '05 #2
Roger Keays <r.*****@ninthave.net> wrote in message news:<3f***********************@news.optusnet.com. au>...
<iframe marginwidth=0 marginheight=0 src=text.html
> onload="this.height=
> this.contentDocument.height">
> </iframe>


I get

Error: uncaught exception: Permission denied to get property HTMLDocument.height

when trying this with Mozilla (?)


Hmm. Intriguing. My version of Mozilla is
Mozilla 1.4
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030908 Debian/1.4-4
I have a page (http://cgt.unizar.es/jornadas/) with the resizing code in
an extended version, and it works:
<iframe
onload="this.height=this.contentDocument.height;
this.contentDocument.body.style.borderStyle='none' ;
this.contentDocument.body.style.marginTop=0;
this.contentDocument.body.style.marginBottom=0;
this.contentDocument.body.style.paddingBottom=0;
this.contentDocument.body.style.paddingTop=0;"
onclick="this.height= this.contentDocument.height"
scrolling=auto width=100% height=0 frameborder=0
src=punterosSL.html>
Tu browser no soporta iframes. Carga directamente el
<a href=punterosSL.html>fichero</a>
</iframe>

except for the onclick :-( But the onload does its work perfectly.
All the other stuff, btw, is just to avoid the vertical scroll bar nuissance.
Jul 20 '05 #3
alejandro.rivero wrote:
<iframe onload="this.height=this.contentDocument.height"/> Error: uncaught exception: Permission denied to get property
HTMLDocument.height
DHTML and HTML are practically unrelated disciplines, please see
http://www.cs.tut.fi/~jkorpela/usenet/xpost.html. Also check out your
cross-site-scripting privleges. And use real properties:

this.setAttribute ( "height", this.contentDocument.
getElementsByTagName ( "body" ).item ( 0 ).
offsetHeight );
All the other stuff, btw, is just to avoid the
vertical scroll bar nuissance.


To handle this in Mozilla, style the content-documents:

:root {
overflow: moz-scrollbars-horizontal;
height: 100%;
}

Explorer has an overflow-x property to check. Both browsers support
adding these styles by force.
Regretly, the onload tag does not work in konqueror.


Tapping into iframe events is badly supported in most browsers. Perhaps
You can pass the information from content-document to the surrounding
enviroment for wider browser support.

window.addEventListener ( "load", function () {
top.yourResizeFunction ( document.body.offsetHeight );
}, false );

--
Wired Earp
Wunderbyte
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim Schueler | last post by:
Here is some sample code that uses inherited class methods: package parseHTML ; sub parseHTML::docomment { my $comment = shift ; print $comment, "\n" ; }
2
by: Csaba2000 | last post by:
I want to be able to embed a single quote into an INPUT element within a dynamically generated IFRAME. The example below shows how the IFRAME is generated. Challenge: I'd like the alert box to...
4
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I...
2
by: Templar | last post by:
Hi i'm bothering with such problem... I must dynamic create an Iframe, and then put som raw HTML into it. But I can't. When I create iframe, I can't access its properties. Here's the coe...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
4
by: CompGeek | last post by:
Hi there, I am trying to load a file with 1729 records into a DB2 UDB EEE 7.1 DataBase (on AIX 4.3) which is across two partitions. The partitioning key is BI_INSTITUTIONAL_KEY which is a BIGINT...
0
by: tequilamala | last post by:
I have an Iframe in one of the pages i am developing... the iframe is suppose to scroll up and down and the links target the iframe. the problem is that the iframe scrolls side to side on internet...
1
by: Z1P2 | last post by:
I would like to gradually resize an iframe in an onmouseover event. I can easily do it with an image, but when I try to do it with an iframe, it doesn't do anything. So first of all, is it possible...
6
code green
by: code green | last post by:
A while ago I decided I like the idea of __autoload or what seems to be better spl_autoload_register(), so now all my projects use this. But a major problem arises using third party classes...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.