'null' is null or not an object error on javascript

Posted on 2008-10-07
Last Modified: 2012-08-13
I've successfully set up Chat (
On Firefox and Google Chrome it works fine without errors, but with MSIE6,7 it complains:
'null' is null or not an object error on javascript , about this function

function user_active_ajax(myvar) {
      var chatusers = document.getElementById('div_chat_users');
      var currentuser = document.getElementById('div_current_user');
      //JS Logic
      var messageArray = myvar.split(',');
      var resultHTML='';

      for (var i=0; i < messageArray.length; i++) {
            resultHTML = resultHTML      + (messageArray[i]+'<br/>')
      chatusers.innerHTML = resultHTML; <------------------------------------ error line

from ajax/functions.js

Question by:tomzu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

mverschoof earned 75 total points
ID: 22658197
is the script loaded before the div (div_chat_users)? If so, it doesn't know where to place the innerHTML code

Hope this helps

Assisted Solution

priya_patil earned 50 total points
ID: 22658239
if the error line is thid than this means that
var chatusers = document.getElementById('div_chat_users'); returns null
IE7 is not able to find any div with id "div_chat_users"

Author Comment

ID: 22658548
That partly solved my problem. Is anyone willing to help more?

This is example page of chat script

If I use MSIE, after I post a message, all messages dissapear. When you post again, they show up for some time (~2sec) then dissapear again.

Author Comment

ID: 22684922
Solved by myself :)
LVL 42

Expert Comment

by:David S.
ID: 22685225
For anyone who finds this later, would you please tell us what the problem turned out to be and what your solution was?

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tools for analysis of code 4 47
Rotate images for Web Page 11 26
null, truthy, falsey confusion 25 30
15 puzzle in Javascript/html 2 40
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question