Recieving Error: 'theForm' is undefined



I have an ASP.NET application which is giving the following JavaScript
error:

'theForm' is undefined

However, when I did a View Source I noticed that ASP.NET added the following
code:

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>

I was told in a previous posting that the reason for the error is that the
script containing the declaration and assigning of a value to it occur
before the

--
Nathan Sokalski
njsokalski@xxxxxxxxxxx
http://www.nathansokalski.com/


.