Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Access to "parent class"
Old 02-09-2008, 01:29 PM Access to "parent class"
Junior Talker

Posts: 1
Name: Solveig Rois
Trades: 0
I'd like to access a class above the one that is accessible via "this". Is there something like PHP's "parent::"?

I use the "Prototype"-JS-Lib, just to make my example code more understandable...

I'll post some code to explain my problem:

Code:
var comments = {
    isFormOk: function()
    {
        progressIndicator('comment-sent', {status: 'load'});
        
        var elementsFail = checkUserData(['title', 'desc', 'mail'], '');
        elementsFail.each(function(element) {
            $('l' + element).setStyle({color: 'rgb(255, 0, 0)'});
        });
        
        if (!elementsFail.length)
        {
            progressIndicator('comment-sent', {status: 'none'});
            return true;
        }
        else
        {
            progressIndicator('comment-sent', {status: 'fail'});
            return false;
        }
    },
    sendComment: function()
    {
        if (this.isFormOk())
        {
            instance = this;
            $('comment').request(
            {
                parameters: {title: $F('title'), desc: $F('desc'), mail: $F('mail'), name: $F('name')},
                encoding: 'utf-8',
                onSuccess: function(response)
                {
                    this.isServerScriptOk(response); //at this point I'd like to call isServerScriptOk() function, which is one level above (?)...
                },
                onFailure: function()
                {
                    progressIndicator('comment-sent', {status: 'fail'});
                },
                onCreate: function()
                {
                    progressIndicator('comment-sent', {status: 'load'});
                    writeUserData(['name', 'mail']);
                }
            });
        }
    },
    isServerScriptOk: function(response)
    {
        if(response.responseText)
        {
            progressIndicator('comment-sent', {status: 'ok'});
        }
        else
        {
            progressIndicator('comment-sent', {status: 'fail'});
        }
    },
    toggleNewComment: function()
    {
        Effect.toggle('newcomment', 'slide', {beforeStart: function() {
            insertUserData(readUserData(['name', 'mail']));
        }});
    }
}
Hoping for many useful answers ...

Many thanks in advance!
dodeantn23 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Access to "parent class"
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13889 seconds with 12 queries