nicolet Posted May 1, 2009 Share Posted May 1, 2009 The pagehttp://homepage.mac.com/eltiopaco/Alice/Th.../pg/Alice2.htmlis part of a Web site I am developing under Mac OS X. Clicking a combination of bits on this page calculates (by JavaScript) the decimal value. All works fine on my Mac with MacOS X Safari, Firefox, Opera, OmniWeb browsers. A friend informed me that the animation does not work under Windows, neither with Explorer nor with Firefox. Where is the problem? Isn't HTML, CSS and JavaScript the same in every operating system?Thanks for any help. CheersFrançois Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2009 Share Posted May 1, 2009 It seems to work in Opera, although it requires one click to focus the image and another to toggle it, but the calculation works. On IE the animation works but the calculation does not. Firefox wants to download the HTML file.I'm not sure about using numbers as IDs though, I'm not sure that an ID can start with a number. Maybe use something like this instead:id="bit0" and then:document.getElementById("bit" + id).src ...I would use a different way to detect if they are set though, use the b array instead of i and j. function swap(id) { if (b[id] == 0) { document.getElementById("bit" + id).src = '../../../images/Bit1.gif'; b[id] = 1; } else { document.getElementById("bit" + id).src = '../../../images/Bit0.gif'; b[id] = 0; } document.getElementById('sum').innerHTML = b[0] + b[1]*2 + b[2]*4 + b[3]*8 + b[4]*16 + b[5]*32 + b[6]*64 + b[7]*128; } Instead of using "textContent", try "innerHTML" instead. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.