JORGEMAL Posted November 3, 2009 Share Posted November 3, 2009 I have a web form with 3 pairs of listboxes, 6 listboxes total. I perform exactly the same actions in a pair by pair basis so I would like to use the same function code for the 3 pairs passing 2 listboxes as parameters depending on which pair will be used. Is it possible to indicate a function that a parameter is a listbox?Please advice.Best regards,Jorge Maldonado Link to comment Share on other sites More sharing options...
justsomeguy Posted November 3, 2009 Share Posted November 3, 2009 You can send any arguments to a function. The arguments can be scalar variables like numbers or strings, or objects or functions or whatever else you want. Link to comment Share on other sites More sharing options...
jeffman Posted November 3, 2009 Share Posted November 3, 2009 The real question for me is HOW do you want to call them? It might make a difference if you call them from an change event or from a button. The concept is simple, but the actual syntax will change. Could you describe the situation a little more? Specifically, what event/element will call this function? Link to comment Share on other sites More sharing options...
JORGEMAL Posted November 3, 2009 Author Share Posted November 3, 2009 The real question for me is HOW do you want to call them? It might make a difference if you call them from an change event or from a button. The concept is simple, but the actual syntax will change. Could you describe the situation a little more? Specifically, what event/element will call this function?The function shoudl be called from a button's click event. I am passing items from one listbox to the other so when I click a button then I add the selected item in the first listbox to the second listbox.Regards,Jorge Maldonado Link to comment Share on other sites More sharing options...
justsomeguy Posted November 3, 2009 Share Posted November 3, 2009 It would probably make the most sense to have a function that accepts the IDs of the two boxes, where it can look up the selected record in the first one and add it to the second one. So all the function would need are the IDs of the two boxes, and you would use document.getElementById to access each select element and figure out which record is selected. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.