troubleshooting Question

document.getElementById("Id") Not Working In Firefox

Avatar of Member_2_3703398
Member_2_3703398Flag for United Kingdom of Great Britain and Northern Ireland asked on
JavaScriptCSSWeb Browsers
3 Comments1 Solution5282 ViewsLast Modified:

I can for the life of me work out why this code works in IE and not Firefox. I am sure it is going to be something simple but I can not see the wood for the trees!

Summary: All this code does is put a message at the bottom of the browser based on the browsers active display area. I need to do this as height:100% no longer works with the new XHTML standards.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
	<title>Dynamic Message Footer</title>
<script language="javascript" type="text/javascript">
function ScreenSize()
	offset = 24;
	if (window.innerWidth) //if browser supports window.innerWidth
		var myWidth = window.innerWidth;
		var myHeight = window.innerHeight;
		if (document.all) //else if browser supports document.all (IE 4+)
			var myWidth = (document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth;
			var myHeight = (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
	document.getElementById("divMain") = (myHeight - offset);
<body onload=ScreenSize() onresize=ScreenSize() style="margin: 0px; padding-right: 0px; padding-left: 0px; padding-bottom: 0px; padding-top: 0px; height: 100%;">
	<form id="formMain" runat="server">
		<div id="divMain" style="left: 0px; position: absolute; top: 183px;">
			<table bordercolor="#ffcc00" bordercolordark="#ff9900" bordercolorlight="#ffcc99"
				border="1" width="100%" bgcolor="#cccccc" id="tableMain" cellpadding="0" cellspacing="0">
						System Message:&nbsp;<asp:Label ID="LabelSystemMessage" runat="server" Text="Label"></asp:Label>
CS file Code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
			LabelSystemMessage.Text = "Test Message Should Appear At The Bottom Of The Screen";
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros