Jump to content

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


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:

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

<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" />

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.


Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.