I made this as a test and it works:
Code:
<html><head><title>Test</title> </head>
<body>
<form>
<input type="submit">
</form>
<script>
function override_submit()
{
alert("It works!!");
}
var form = document.getElementsByTagName("form")[0];
form.onsubmit = override_submit;
</script>
</body>
</html>
I used [0] instead of [1], but I thought maybe you used 1 because there was another form on the page.