471,887 Members | 865 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 4986
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
reply views Thread by zermasroor | last post: by

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.