radioScan Widget Fixed
radioScan is a javascript widget I created so that readers could browse through s l a m 's post titles in a side window, while displaying the whole post in the main browser window whenever they click on a title. Try it from the left sidebar.
radioScan adds an alternate, more topic oriented, way of accessing s l a m 's content, in addition to the chronological weblog method (not that there's much content on s l a m yet, but this is going to change eventually :-)
I've been struggling on and off for 2 weeks, trying to find out why the javascript code was working fine with later versions of Internet Explorer, but failing miserably with Gecko based browsers such as Mozilla and Netscape.
While re-reading the messages I had received after asking for help (thanks everyone btw, this is a great community), and after reviewing some other, unrelated, code, I finally saw the light: as usual, it was a lot simpler (and dumber) than I thought :-)
So here are the gory details.
What radioScan does is define a 'table of contents' javascript object class, with 2 methods, reset and write. To do this, I had first written the table object contructor function, Toc(), then both class methods, using the following syntax:
function Toc.prototype.reset() { some code ... }
function Toc.prototype.write() { some other code ... }
Wrong move, didn't please Gecko.
What works is to define the reset and write functions independently, before the Toc object constructor function, with something like:
function Reset_Toc() { some code ... }
function Write_Toc() { some other code ... }
Then, after the Toc constructor function, add 2 lines like this:
Toc.prototype.reset = Reset_Toc;
Toc.prototype.write = Write_Toc;
That's all there is to it. When I create a Toc class object in the onload attribute of the widget's frameset definition, Gecko doesn't drop dead any more:
onload="toc = Toc(); toc.reset();"
Mozilla 1.0rc1 actually runs the code faster on my Powerbook/MacOS X system than Internet Explorer. So far, I've tested radioScan with all later versions of IE on Windows 98, NT4, MacOS 9, and MacOS X, with Mozilla 1.0rc1 on MacOS X and Linux RedHat 7.2, and with Netscape 6 on MacOS 9 and MacOS X.
To download the updated package, refer to the storyList and radioScan howto.
12:47:26 AM Google It!
|