Jump to content

'document.getElementsByTagName(...).1' is null or not an object error


ERuiz

Recommended Posts

Hello all,

I am getting this error message everytime I access a page which has a small javascript snippet. The thing is that the page is actually working properyly, but this error message is really driving me nuts and makes the page look unprofessional.

Here is the javascript snippet in the page, which is causing the error message:

[code]
<script language="JavaScript" type="text/javascript">
function updatehours ( selectedtype )
{
  document.logbook.userid.value = selectedtype ;
  document.logbook.submit() ;
}
</script>

<form name="logbook" action="updatehours.php" method="post">
<td valign="top" rowspan="3" STYLE="text-align: left; font-weight: bold; padding-left: 6px;"><a href="javascript:updatehours('<?php echo $userid; ?>')" target="_self" >UPDATE TOTAL HOURS</a></td>
<input type="hidden" name="userid" />
</form>[/code]

This little script, makes a regular link act like a form button when a user clicks it. What is causing this error message?

BTW, the error message only appears on IE.

Regards,

ERuiz
are you using getElementsByTagName anywhere in your code?

and i would suggest that you change the way that you point to elements on your page. Use the id identifier, it is faster. give your elements unique id's then reference them like
document.getElementBy('id').submit() etc

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.