general function who activate callback on every object - please help

  • Thread starter Montezuma's Daughter
  • Start date
M

Montezuma's Daughter

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);
 
T

Thomas 'PointedEars' Lahn

Montezuma's Daughter said:
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:

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top