I have the following tidbit of script that runs in the body onload of an ASP.NET page.
Document.forms errors out every time ctl is null or blank:
document.forms(...).elements(...) could not be found
Am I doing something wrong syntactically?
Thank you!!
Paul
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Status Tracker</title>
<link href="styles.css" type="text/css" rel="stylesheet" />
<script language="javascript">
function setFocus()
{
ctl = "<%= controlToFocus %>";
if (ctl != "") {
if (ctl != null) {
document.forms("TimeEntry").elements(ctl).focus();
}
}
}
</script>
</head>
<body onload="setFocus();">
Document.forms errors out every time ctl is null or blank:
document.forms(...).elements(...) could not be found
Am I doing something wrong syntactically?
Thank you!!
Paul
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Status Tracker</title>
<link href="styles.css" type="text/css" rel="stylesheet" />
<script language="javascript">
function setFocus()
{
ctl = "<%= controlToFocus %>";
if (ctl != "") {
if (ctl != null) {
document.forms("TimeEntry").elements(ctl).focus();
}
}
}
</script>
</head>
<body onload="setFocus();">