469,271 Members | 1,435 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Javascript that works in IE but not Firefox

Anybody know why the following works in IE but not in Firefox? All it does is fix everything above it as a header and let everything below it scroll.

Height: 0px ;
Width: 100% ;
overflow: auto ;
<div id="Body" class="documentBody">
<script language='JavaScript' type='text/javascript'>
var bodyElement = document.body.all['Body'];
function LayoutBodyElement() {
bodyElement.style.posHeight = document.body.offsetHeight- bodyElement.offsetTop;
function document.onreadystatechange() {
document.body.scroll = "no";
LayoutBodyElement( );
window.onresize = LayoutBodyElement;
May 12 '07 #1
1 4936
428 256MB
If you want to work beyond IE you ought to run the firefox or opera browser on your code and check the debugging console. Here are some problems that need a common language to make sense to other browsers:

1. var bodyElement = document.body.all['Body'];
//document.body.all is not defined.

2. bodyElement.style.posHeight
// posHeight is undefined, use 'height' and set a string with 'px' units

3. bodyElement.offsetTop
// bodyElement is an undefined variable- do you want document.getElementById?

4. function document.onreadystatechange()
// the dot in the declaration causes an error
(in IE there is no error, but document.onreadystatechange remains undefined.
Perhaps document.onreadystatechange=function()
May 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Howard Kaikow | last post: by
5 posts views Thread by LRW | last post: by
2 posts views Thread by John | last post: by
8 posts views Thread by chrisdude911 | last post: by
4 posts views Thread by lmarceglia | last post: by
11 posts views Thread by minnesotti | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.