This is my first post here. Thus, I'll like to say hello to everybody
in this community and I want to appologize if this question was asked

I am a web developer for a site that has 1mil+ visitors/month: www
[dot] ziare [dot] ro, and I want to use the Prototype Framework to
make an element refresh itself (with an scriptaculous Effect)

This is my class:

var Dynamic = Class.create({
        initialize: function(selector, container, script)
                this.selector  = selector;
                this.script    = script;
                this.container = container;

                this.changeContent = 

        getContent: function()
                new Ajax.Request(this.script, {
                        onSuccess: function(req)
                                this.content = req.responseJSON;
                $$(this.selector).invoke('observe', 'click', 
        changeContent: function(event)
                /*new Effect.Fade($(this.container), { afterFinish: function() {
                                new Effect.Appear($(this.container));
document.observe('dom:loaded', function() {
        var dyn = new Dynamic(".tzNavLink a", "tzContent",

'tzContent' is the div whose content changes by clicking on of the
links with the 'tzNavLink' css class (the 1 2 3 4 5 6 links on www.ziare.ro).

The problem is that this.content is undefined in changeContent (a
function that listens for the click event), although this.container
works well in the same function. Why is that? It has something to do
with the Ajax.Request?

Also, I want to ask how can I 'tzContent' to change periodically using
such and object (I want everything to be encapsulated so I can use
this object in other projects)?

Thank you for your response.

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to