|
|
Feedback on: Multi-dialogue forms on one page
irt.org | About | Feedback | 1840 [ previous next ] Feedback on: Sent by Worth: Comments: First, the code fails to cache properties and instead repeats lookups. For example, within the show() function, the expression, document.hiddenForm, appears repeatedly. Accessing the document object itself can be expensive. Accessing a property on the same object repeatedly is a waste of time. Instead, a local variable, perhaps hiddenForm should be assigned that property (var hiddenForm = document.hiddenForm;), then reused everywhere else. (A similar issue arises near the bottom of the same function in accessing document.layers['myTab'].document. Whew!) Second, the show() function puts the HTML for all the tabs into a single function. The code will be easier to maintain if show() calls showTab1(), showTab2(), etc. Those functions can return an HTML string that show() can use for the rest of its work. Third, this technique is not truly reusable. It is reusable, in the sense that you can copy and paste the code, then change the HTML, etc., to create a new form. However, it is not truly reusable because there is no framework that can be parameterized with the custom form content. I haven't created a better version at this time, and I don't know that I'd be able to share it if I did, but I'm certain a reusable framework is possible. Other feedback on 'Multi-dialogue forms on one page' - show all
|
-- div -->
|