Ruby Forum Rails Spinoffs > newbie scriptaculous loop question

Posted by officermahoney (Guest)
on 13.05.2008 06:29
(Received via mailing list)
Hi, I haven't done much javascript in the past so this is probably
something really simple.  Here is a snippet of the code I am working
with:

---------------------

var myProjects = [
  "projectA",
  "projectB"
];
for(i = 0; i < myProjects.length; i++) {
  // ADD PREVIOUS BUTTON
  vPrevButton = Builder.node('div',{className:'carousel_prev_btn',
onclick:'fLoadPrevProjectScreen(myProjects[i])'});
  $("carousel_" + myProjects[i]).appendChild(vPrevButton);
}

---------------------

My problem is that I want the onclick function to process
myProjects[i] BEFORE it's appended to the HTML element.  So for the
first loop, the onclick event would be
'fLoadPrevProjectScreen("projectA")'. Thanks in advance for your help
on my dumb question.
Posted by officermahoney (Guest)
on 13.05.2008 06:53
(Received via mailing list)
nvm, figured it out
me = retarded.