Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33357
| From | Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Instead of <iframe onload=... |
| Date | 2017-05-20 22:15 +0100 |
| Organization | Home |
| Message-ID | <hogR$$KPILIZFwpJ@invalid.uk.co.demon.merlyn.invalid> (permalink) |
| References | <5638b17e-4ab2-4605-ac32-b399ddcfa099@googlegroups.com> <ofmrnu$sc9$1@news.albasani.net> <b06552ca-cd04-4314-8dea-76a7630b4058@googlegroups.com> |
In comp.lang.javascript message <b06552ca-cd04-4314-8dea-76a7630b4058@go
oglegroups.com>, Fri, 19 May 2017 14:30:08, Dr J R Stockton
<J.R.Stockton@physics.org> posted:
By the way, method ondatasetcomplete was not found useful.
>Perhaps I should put, in a general include file, something like
>
>function Elasticate(Sauce, DefaultHeight) {
> // code to insert into DOM at this point ...
> // make iframe
> // iframe onload = Procrustes (this, DefaultHeight)
> .. iframe src = Sauce
> // end DOM code
> }
>
>and put in the HTML of the pages something like
>
><script ...> Elasticate("pagelet.htm", 45) </script>
I am now putting. for example,
<script type="text/javascript"> Ink("$compost.htm", 69) </script>
in the HTML pages, and have added the following in a commonly-included
script file.
function Ink(Sauce, DefaultHeight) { var Fram
// code to create and insert iFrame into DOM where called ...
Fram = document.createElement("iframe")
Fram.style.border = "2px solid red"
Fram.style.width = "100%"
Fram.style.margin = "0.5ex 0"
Fram.style.background = "#FFE"
Fram.onload = Inky(Fram, DefaultHeight)
document.body.appendChild(Fram)
Fram.src = Sauce }
function Inky(Ifr, ExHi) {
// Autosize works in Firefox and MS IE (Edge?), else use ExHi
setTimeout(function() { Procrustes(Ifr, ExHi) } , 500) }
function Procrustes(Ifr, ExHi) { var Ht
try { Ht = Ifr.contentDocument.documentElement.scrollHeight }
catch(e) { Ht = 0 }
Ht = (Ht==0 ? ExHi + "ex" : Ht + "px") // ; alert(Ht)
Ifr.style.height = Ht }
The setTimeout appeared necessary for the frame height needed to be
discoverable by Procrustes; perhaps there is a better way.
Sometimes, an iFrame appears further down the document than intended,
when two are adjacent.
Alas, iFrame has a minimum height.
That got rid of almost all of the iFrame onloads; a couple of special
cases needed a minor addition to the above code.
--
(c) John Stockton, Surrey, UK. ¬@merlyn.demon.co.uk Turnpike v6.05 MIME.
Merlyn Web Site < > - FAQish topics, acronyms, & links.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Instead of iframe onload? Dr J R Stockton <J.R.Stockton@physics.org> - 2017-05-18 05:40 -0700
Re: Instead of iframe onload? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-05-18 15:07 +0200
Re: Instead of iframe onload? Dr J R Stockton <J.R.Stockton@physics.org> - 2017-05-18 08:11 -0700
Re: Instead of iframe onload? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-05-18 18:09 +0200
Re: Instead of iframe onload? Andrew Poulos <ap_prog@hotmail.com> - 2017-05-19 12:36 +1000
Re: Instead of iframe onload? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-05-19 09:15 +0200
Re: Instead of iframe onload? Andrew Poulos <ap_prog@hotmail.com> - 2017-05-19 18:12 +1000
Re: Instead of iframe onload? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-05-19 11:47 +0200
Re: Instead of iframe onload? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2017-05-19 02:44 -0700
Re: Instead of iframe onload? Martin Honnen <martin.honnen@gmx.de> - 2017-05-19 15:25 +0200
Re: Instead of iframe onload? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-19 18:11 +0200
Re: Instead of iframe onload? Dr J R Stockton <J.R.Stockton@physics.org> - 2017-05-19 14:30 -0700
Instead of <iframe onload=... Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-05-20 22:15 +0100
Re: Instead of <iframe onload=... Stefan Weiss <krewecherl@gmail.com> - 2017-05-21 02:10 +0200
Re: Instead of <iframe onload=... Dr J R Stockton <J.R.Stockton@physics.org> - 2017-05-21 11:46 -0700
Re: Instead of <iframe onload=... Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-05-24 23:18 +0100
Re: Instead of <iframe onload=... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-21 23:22 +0200
Re: Instead of <iframe onload=... Stefan Weiss <krewecherl@gmail.com> - 2017-05-22 00:39 +0200
Re: Instead of <iframe onload=... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-22 01:38 +0200
Re: Instead of <iframe onload=... Stefan Weiss <krewecherl@gmail.com> - 2017-05-22 02:19 +0200
Re: Instead of <iframe onload=... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-22 02:35 +0200
Re: Instead of <iframe onload=... Stefan Weiss <krewecherl@gmail.com> - 2017-05-22 12:54 +0200
Re: Instead of <iframe onload=... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-22 15:37 +0200
Re: Instead of <iframe onload=... Stefan Weiss <krewecherl@gmail.com> - 2017-05-22 18:23 +0200
Re: Instead of <iframe onload=... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-23 14:15 +0200
Re: Instead of <iframe onload=... Stefan Weiss <krewecherl@gmail.com> - 2017-05-23 15:56 +0200
Re: Instead of <iframe onload=... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-23 18:41 +0200
Re: Instead of <iframe onload=... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-22 03:27 +0200
csiph-web