[Last Call] Learn how to a build a cloud-first strategyRegister Now


JavaScript error starts appearing from website in Internet Explorer

Posted on 2009-04-27
Medium Priority
Last Modified: 2012-05-06
I have a web page which includes a javascript that performs an image rotator which had been working fine even in Internet Explorer when I got it all setup just a few months ago, but now when I open this page, it indicates the following error details:

Line 42
Char: 3
Error: 'null' is null or not an object
Code: 0

when I go to my source code, it seems to be pointing to the following line of code:


What I don't understand is why would it work before, and now it does not even with no changes, in Internet Explorer.  Intriguingly it does work when I open it in Firefox.
<script type="text/javascript">
var imgs1 = new Array("images/picture1.jpg",
var imgs2 = new Array("images/picture5.jpg",
var lnks1 = new Array("","","","");
var lnks2 = new Array("","","","");
var alt1 = new Array("","","","");
var alt2 = new Array("","","","");
var currentAd1 = 0;
var currentAd2 = 0;
var whichImg = 0;
var whichCtl = 2;
var imgCt1 = 4;
function cycle1() {
  if (currentAd1 == imgCt1) {
    currentAd1 = 0;
  if (currentAd2 == imgCt1) {
    currentAd2 = 0;
  if (whichImg == whichCtl) {
    whichImg = 0;
var banner1 = document.getElementById('adBanner1');
var banner2 = document.getElementById('adBanner2');
var link1 = document.getElementById('adLink1');
var link2 = document.getElementById('adLink2');
  if (whichImg == 0) {
  if (whichImg == 1) {

Open in new window

Question by:accucom
  • 2
  • 2
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 24243494
Can you provide some example page for that ? I paste this code to IE and it works ok :)

Author Comment

ID: 24243807
Here's the link in particular:

LVL 18

Accepted Solution

Pawel Witkowski earned 2000 total points
ID: 24245098
I tried to install Microsoft Script Editor on this computer but I spent alot of time and I think that I found a problem without it :)

just try instead of:

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

So this make sure that you refer to ID in document that is in fact created (2 sec can be not enough )

Author Closing Comment

ID: 31574957
Thanks wilq32, that worked, and still worked on Firefox so I'm happy now.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

This article discusses how to create an extensible mechanism for linked drop downs.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

831 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