G
Greg-WBSR
Would anyone be kind enough to tell me how to go about adding a
parameter to this function....
function toggleVis() {
isVisible = !isVisible;
networkLink.setVisibility(isVisible);
reportState();
}
I want to pass a parameter - eg 'green'
eg toggleVis('green');
so the end result equals this function
function greentoggleVis() {
greenisVisible = !greenisVisible;
greennetworkLink.setVisibility(greenisVisible);
reportGreenState();
}
I have a lot of files (green,blue,black etc) to toggle, and would like
to be able to use the one function and just pass the name of the file.
Right now I have 1 function per file which is pain to copy and edit
every time a new file gets created.
currently I am also creating global variables - greenisVisible and
greennetworkLink
is that needed???
I thought it would be something like
function toggleVis(file) {
(file)isVisible = !(file)isVisible;
(file)networkLink.setVisibility((file)isVisible);
report(file)State();
}
but obviously I am wrong.
any help would be appreciated
Thanks
Greg
parameter to this function....
function toggleVis() {
isVisible = !isVisible;
networkLink.setVisibility(isVisible);
reportState();
}
I want to pass a parameter - eg 'green'
eg toggleVis('green');
so the end result equals this function
function greentoggleVis() {
greenisVisible = !greenisVisible;
greennetworkLink.setVisibility(greenisVisible);
reportGreenState();
}
I have a lot of files (green,blue,black etc) to toggle, and would like
to be able to use the one function and just pass the name of the file.
Right now I have 1 function per file which is pain to copy and edit
every time a new file gets created.
currently I am also creating global variables - greenisVisible and
greennetworkLink
is that needed???
I thought it would be something like
function toggleVis(file) {
(file)isVisible = !(file)isVisible;
(file)networkLink.setVisibility((file)isVisible);
report(file)State();
}
but obviously I am wrong.
any help would be appreciated
Thanks
Greg