Solved

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

Posted on 2008-10-07
5
517 Views
Last Modified: 2012-08-13
I've successfully set up Chat (http://www.ebrueggeman.com/phpsimplechat/index.php)
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

Ideas?
0
Comment
Question by:tomzu
[X]
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
5 Comments
 
LVL 5

Accepted Solution

by:
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
0
 
LVL 2

Assisted Solution

by:priya_patil
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"
0
 

Author Comment

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

This is example page of chat script http://www.ebrueggeman.com/phpsimplechat/examples.php

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.
0
 

Author Comment

by:tomzu
ID: 22684922
Solved by myself :)
0
 
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?
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…
Suggested Courses

627 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