/    Sign up×
Community /Pin to ProfileBookmark

Browser Compatibility

I have two strings of IE code that I can’t find Mozilla equivalents for.

String 1. I need the full page height of the iFrame. Not the screen height. This works in IE but not others.
[INDENT]document.body.scrollHeight[/INDENT]

String 2. Calling a function that’s in the parent window from the child(iFrame) window. Both of these work in IE, but not other browsers.
[INDENT]window.top.myFunction()[/INDENT]
[INDENT]window.parent.myFunction()[/INDENT]

I know the problem isn’t the function. It’s been tested on all major browsers and works fine.

If anyone has any idea please respond and thank you!

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@nbcrockettauthorAug 08.2005 — Is there anyone who can help me with this question.
Copy linkTweet thisAlerts:
@UltimaterAug 08.2005 — A wild guess (untested):
<i>
</i>var sh=(document.body.scrollheight &gt;= document.body.clientHeight)?
document.body.scrollheight:document.body.clientHeight;
Copy linkTweet thisAlerts:
@KravvitzAug 08.2005 — 1) http://www.quirksmode.org/viewport/compatibility.html

2) try it without "window."
top.myFunction()

parent.myFunction()
Copy linkTweet thisAlerts:
@nbcrockettauthorAug 09.2005 — The function code didn't work and I can't test the height code properly without it. I do have a question about the height code. Is the '?' mark supposed to be there or was that a typo and it should be ';'. Thanks for your suggestions. Do you have any other ideas that might make this work?
Copy linkTweet thisAlerts:
@UltimaterAug 09.2005 — Yes the question mark is supposed to be there. You can put that statement on one line if you wish (doesn't make a difference). I just put it on two so you can see the whole code w/o having to scroll.

Let me show you a simple example using the question mark:
<i>
</i>&lt;script type="text/javascript"&gt;
var a=(true)?"yes":"no"
alert(a)
var b=(false)?"yes":"no"
alert(b)
&lt;/script&gt;
×

Success!

Help @nbcrockett spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...