body onload - where to insert?

focax 18 Nov, 2010
This is probably a very simple question.
I have a few forms and I would like to place some js code on the 'onload' event of the form.
Where should I insert the "body onload" code for it to work?
Thanks!
GreyHead 18 Nov, 2010
Hi focax,

Put it in the form JavaScript box but wrapped in a function like this
window.addEvent('load', function() {
  // add your script here
}); 

Bob

PS I prefer the MooTools 'domready' event which fires a little earlier
focax 19 Nov, 2010
Great Bob, solved my issue. I will take a look at your MooTools suggestion too.
Really appreciate it.
Take care!
This topic is locked and no more replies can be posted.