You can debug Javascript in IE using the Microsoft Script Debugger for Mozilla use the http://getahead.ltd.uk/ajax/venkman
To start the debugger put a debugger; statement in your Javascript code
Another very useful tools is the Mozilla Javascript Shell plugin that allows you to run arbitary Javascript code e.g
body = document.getElementById('body')
props(body)
The above two lines lets you see all the properties of the body HTML element