general function who activate callback on every object - please help

Discussion in 'Javascript' started by Montezuma's Daughter, Oct 26, 2008.

  1. Thank you for your preveious help in the JS forum
    can you help my to understand why it is still doesn't work?
    I am trying to make a usefull func (ActivateFuncOnObjects3) which can
    recieve a list ("obj1,obj2") and activate different func on every
    object of the list

    thanks

    function DisableF2()
    {
    OBJECT(text).disabled=true;
    }

    function ActivateFuncOnObjects3(list,Callbackfunction)
    {
    return function() { Callbackfunction(text); };
    }

    function ActivateFuncOnObjectsFromList(list,fn)
    {
    var arr = list.split(',');
    for(var i=0;i<arr.length;i++)
    {
    fn(arr);
    }
    }

    var list='obj1,obj2';
    var v3 = ActivateFuncOnObjects3(list,DisableF2)
    ActivateFuncOnObjectsFromList(list,v3);
    Montezuma's Daughter, Oct 26, 2008
    #1
    1. Advertising

  2. Re: general function who activate callback on every object - pleasehelp

    Montezuma's Daughter wrote:
    > Thank you for your preveious help in the JS forum


    Which "JS forum" are you talking about?

    > function DisableF2()
    > {
    > OBJECT(text).disabled=true;
    > }


    `DiableF2' is unused. `OBJECT' and `text' are undefined. Besides, `OBJECT'
    is an identifier unwise to choose, since there is the built-in `Object'.

    > function ActivateFuncOnObjects3(list,Callbackfunction)
    > {
    > return function() { Callbackfunction(text); };
    > }


    `list' is unused.

    I recommend you use a source code editor that points out these errors, such
    as the JavaScript Editor plugin from Eclipse's Web Development Tools:

    <http://download.eclipse.org/webtools/downloads/>

    > var list='obj1,obj2';


    Use Array objects for lists, not comma-separated strings.

    Besides, identifiers should start lowercase unless they specify constructors
    or constants (just code style).


    PointedEars
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
    Thomas 'PointedEars' Lahn, Oct 26, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mark | r
    Replies:
    2
    Views:
    1,403
    mark | r
    Aug 1, 2003
  2. KK
    Replies:
    2
    Views:
    528
    Big Brian
    Oct 14, 2003
  3. =?Utf-8?B?SXJ3YW5zeWFo?=
    Replies:
    4
    Views:
    2,442
    =?Utf-8?B?SXJ3YW5zeWFo?=
    Oct 30, 2007
  4. Junkone
    Replies:
    2
    Views:
    201
    Jarmo Pertman
    Oct 27, 2010
  5. Replies:
    2
    Views:
    119
    Dr John Stockton
    May 27, 2006
Loading...

Share This Page