View Full Version : javascript not working in NN 4.7

02-09-2004, 06:26 PM
I have the following portion of javascript and in NN 4.7 it gives an error.

The Code:
img name="fullDocImageCit"
if (document.images[fullDocImageCit]) {

And in NN 4.7 it says
document.fullDocImageCit[0] has no properties

I know somethng is wrong in the way I wrote the [fullDocImageCit] but dont know how to fix it.

02-09-2004, 06:56 PM
document.images[fullDocImageCit] will use the value stored in the variable named fullDocImageCit. presumably that variable doesn't exist so it's filling it in with "undefined" or some such.

document.images["fullDocImageCit"] will use the string value "fullDocImageCit" and may give you what you want.

Roy Sinclair
02-09-2004, 07:40 PM
document.fullDocImageCit[0].src is an IE only shortcut. You've got the right reference in the IF statement but then jump to the wrong (proprietary) reference afterwards.

document.images[fullDocImageCit].src will work and it'll fix the same problem which would appear in a modern browser, not just that obsolete antique NS 4.7.