I'm new to JS but I think I'm picking it up not too bad. This problem
has perplexed me. I'm trying to use Prototype and Scriptaculous:

var gameInfo = Class.create();

gameInfo.prototype = {

    initialize: function() {
        if (!document.getElementsByTagName){ return; }
        var anchors = document.getElementsByTagName('a');

        // loop through all anchor tags
        for (var i=0; i<anchors.length; i++){
            var anchor = anchors[i];

            if (anchor.getAttribute('href') && anchor.className ==
'gameTitle'){
                anchor.onclick = function () {myGameInfo.start();
return false;}
            }
        }
    },
    start: function() {
        new Effect.toggle('gameInfo', 'slide');
    }

}

function initGameInfo() { myGameInfo = new gameInfo(); }
Event.observe(window, 'load', initGameInfo, false);

I'll admit, I've based a lot of this code on Lightbox2.0 but it does
something much simpler.

If you go to this (work-in-progress) page
(http://psf.gamehideout.co.uk/dah.php) and click on "Destroy all
Humans!" you'll see what I'm trying to acheive. Of course, you need to
use Firefox or Opera (hopefully Safari as well. Can anyone confirm?) as
it doesn't work in IE.

I know I could get that effect without the above code but I needed it
to degrade gracefully. This way people without JS can view the same
content but on another page (doesn't work yet as the site is very
incomplete).

If anyone can shed light on why this crashes IE I'd be very grateful


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to