View Full Version : NN & IE differences

06-27-2004, 03:28 AM
I have 2 JavaScript functions; the first is, firstSlide(), which calls the second, findObject(obj). The functions behave as expected in IE, but NN is unhappy; the initial value of MyCaption, “Initial Caption” is not replaced with the contents of the variable “myTitle.”

function firstSlide(){
findObject("MyCaption").innerHTML="<i>" + myTitle + "</i>";

function findObject(obj){
alert("getElementById() returns "+document.getElementById(obj));
return document.getElementById(obj);
else if (document.all){
return document.all(obj);

When I run this code in IE the alert in findObject() displays:
getElementById() returns [object]
whereas, in NN the alert displays:
getElementById() returns null.

The object, MyCaption, is, as you might expect, the caption for a table and is created in document body.

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<caption><span id="myCaption">Initial Caption</span></caption>

I’ve made numerous alterations in an attempt to make NN happy, but to no avail. I must be overlooking some basic flaw. Your assistance will be appreciated.

Thanks, GrandpaB

06-28-2004, 05:01 AM
Javascript is case-sensitive.

findObject("MyCaption").innerHTML="<i>" + myTitle + "</i>";
<span id="myCaption">Initial Caption</span>

06-28-2004, 05:30 AM

Thanks, I've been developing for a while and know of JS's sensitivity to case, but I now need to develop for both IE and NN. When, on my first foray into NN it behaved differently than IE, I panicked. I forgot to check the basics.

Thanks again, GrandpaB

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum