xchen
you should start a new thread in this forum - you'll get more chances to be read and answered, as this thread is an old one - what's more, you're a bit off topic (i think your error doesn't come from the submit() function but from the document.myform that is actually not referring to a form)
so, to get a quicker and more accurate answer, i suggest you to start a new thread here (and please include some part of your code : where the function is called, and where the form is named; so that we can fully help you)