By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 2,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

img src change works in FireFox and Safari, but IE not updating images.

P: 3
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php.

As the user makes selections, it updates images of various parts, giving them a preview of the finished item. The preview resides within a div and is simply a series of <br>-separated images. Simple html. The system is working fine with FireFox and Safari, but some MSIE 6 and 7 users are reporting that only the first image is updating and the remainder remain static. I've tried several different approaches over the last two weeks, all with the same frustrating results. I figured it is time to ask others for their insights.

The div contains about 20 small images. The MSIE behavior is: When first loaded, the div content USUALLY displays correctly, but when updated, only the topmost image updates and the rest don't change. For other browsers, all images are updating correctly. I can post the javascript if you wish, but it doesn't appear to be the problem (he said ignorantly).

1) My first approach was to completely replace the div content with new <img> tags using innerHTML each time the user makes a change (document.getElementById(divID).innerHTML = newContent). I have confirmed that the html is valid by vetting at the W3C validator and loading it directly into a web browser. Some MSIE users said this wasn't working, so I tried...

2) Leave the html content static after initial filling of the div, updating the src attributes via document.getElementById(imgID).src = newsrcvalue. Each image has a unique id. Some MSIE users said it still wasnt working, so I tried...

3) After reading about MSIE image update problems, and Microsoft notes, tried inserting the <img> tags without any src attribute (<img name="imgName" id="imgID" ...>, then assign the source attribute. Still didn't work, so....

4) Tried falling back to an earlier DOM0 method to update the src attributes, document.images[imageName].src = newsrcvalue. Still no joy. That same method is working (or at least was) on another, earlier web page.

The initial content of the div is appearing properly, and the topmost image is updating, at least once. But the images below it are not updating in MSIE. In other browsers it seems to work fine. I'm not seeing any warning or errors in the logs on FireFox or Safari. The javascript I'm using all appears valid.

Anyone run into this or have any suggestions as to other means of approaching this problem? I really am out of ideas on this one.

Thanks for your thoughts on this.

Seth
Feb 3 '08 #1
Share this Question
Share on Google+
5 Replies


gits
Expert Mod 5K+
P: 5,333
hi ...

the page-link you gave didn't work with IE6 and had an error ... did you test it with IE? could you trace down to the error ... since it occired in a line 17xx so it is a bunch of lines :) ...

kind regards
Feb 4 '08 #2

P: 3
hi ...

the page-link you gave didn't work with IE6 and had an error ... did you test it with IE? could you trace down to the error ... since it occired in a line 17xx so it is a bunch of lines :) ...

kind regards
Thanks. I'll look into this. Though FireFox js log is showing no errors, I am having problems with both IE6 and 7 working at all now. I appreciate your comment and will see if I can track down what is choking IE.

Seth
Feb 6 '08 #3

gits
Expert Mod 5K+
P: 5,333
Thanks. I'll look into this. Though FireFox js log is showing no errors, I am having problems with both IE6 and 7 working at all now. I appreciate your comment and will see if I can track down what is choking IE.

Seth
did you change something? the firebug showed the 2 mentioned errors ... actually there are some warnings only that shouldn't stop the code to work. now what particular problem do you have? could you explain it?

kind regards
Feb 6 '08 #4

P: 3
did you change something? the firebug showed the 2 mentioned errors ... actually there are some warnings only that shouldn't stop the code to work. now what particular problem do you have? could you explain it?

kind regards
Very kind of you to follow up. Thank you.

I pushed the javascript through two different LINT programs for vetting, did a bunch of small tweaks, then downloaded every web browser I could find (that will run on my Mac) and tested, tested, tested. FireFox, Safari, Camino, Opera, etc. No problems until Opera choked on the use of indexOf against an array, and some people reported that MSIE6 and 7 will do the same, so I added a prototype function for Array.indexOf to cover those bases.

The indexOf was in a position that could have caused the problem I originally reported -- it is in the function that updates the preview images that weren't updating properly for MSIE users. At this point everything looks fine from my end -- but it has all along, so I'm waiting for feedback from MSIE6&7 users/testers to see if this change made "the" difference.

I'll follow up once I have an answer.
Feb 7 '08 #5

gits
Expert Mod 5K+
P: 5,333
could you post the code that made the problems? may be we find a simple workaround for it ...

kind regards
Feb 7 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.