...

View Full Version : javascript not working in NN 4.7



chelvis
02-09-2004, 05: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]) {
document.fullDocImageCit[0].src="avtop.gif"

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.

kansel
02-09-2004, 05: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, 06: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum