Why is window.onload being called?
Years back I wrote some code using Mike Foster's CBE library and the code is overdue an overhaul. I'm trying to convert it to Mike's X Library (libraries at cross-browser.com).
I have a window.onload function that dynamically creates a set of paired div elements, say form1 & summary1, form2 & summary2; it then sets the summary elements to be visible (display="block") and the form ones to be invisible (display="none").
Then I have a "toggle" function that switches visibility between a summary element and it's matching form element.
Toggling from summary to form works fine. But when I toggle back from form to summary the window.onload function gets called again and resets the whole HTML page back to it's initial state.
I hope that's enough detail, I can give more if needed. Basically I don't understand why window.onload is being called when the page is just being rearranged and not loaded, and why it only happens when I hide the form, and not when I hide the summary in order to display the form.
Any ideas appreciated.