Javascript onSubmit in a Form

I have a simple few lines of javascript in the Web ‘onSubmit’ event in a Form which accesses a few fields. As part of debugging I would use ‘alert’. My lines are a little different in the ‘onLoad’ event, but it works with no troubles. Even using an ‘alert’ at the top and bottom. But in the ‘onSubmit’ even using the same few lines from ‘onLoad’ (which work), strange things occur. The second ‘alert’ never shows. In fact, some times the first won’t show. When the first does not show, I can delete a ‘comment’ and then it does show. This is driving me nuts. I can’t find a pattern.

Subject: solution. code size limit

I found the same problem. Showing the source code in the chrome navigator i can see that the code in “onsubmit” is cutted to some max size, loosing code.So I put all “onsubmit” code in a JSHeader function and call it from the “onsubmit” event and it works fine