Discussion Locked

part jscript doesn't work some browsers

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have some javascript on a page that works just like it's supposed to in IE and NN6. However, some of it doesn't work in NN4. What is supposed to happen is whenever the page loads, two images come up... the right one is dependent on the left one. http://www.slumberland.com/new_site/index_javascript.htm

5 replies

by todd.cochrane

The reference to the second image is dependent on the "alt" attribute of the first image being set by the time the second script executes. It's entirely possible the NN4.?? has n't build the DOM model of the page by the time it gets to the second script. Alternatively (no pun intented :-) it could be that NN4 does n't have "ALT" as one of the attributes of an image in its DOM.

Use the variable mystring in place of document.left.alt in the second script. Variables you declare are gobal to the current document.

The first script is:

...
The second is:

I'd also recommend a tidy-up of the script tag. Since the "language" attribute is deprecated, include a "type" attribute, and make sure that the second script contains its internal HTML comment:

by shanghai sam

Although this answer was correct, the answer given to me a day prior helped out considerably. Thanks for a quick reply though.

This discussion is closed to new replies.