ERuiz Posted January 16, 2007 Share Posted January 16, 2007 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 Link to comment https://forums.phpfreaks.com/topic/34433-documentgetelementsbytagname1-is-null-or-not-an-object-error/ Share on other sites More sharing options...
emehrkay Posted January 16, 2007 Share Posted January 16, 2007 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 likedocument.getElementBy('id').submit() etc Link to comment https://forums.phpfreaks.com/topic/34433-documentgetelementsbytagname1-is-null-or-not-an-object-error/#findComment-162147 Share on other sites More sharing options...
ERuiz Posted January 16, 2007 Author Share Posted January 16, 2007 Hi emehrkay,Nop, getElementsByTagName is not being used anywhere on the page.Sorry for my ignorance, but how would I implement the ID identifier on the script I posted above?Thanks,ERuiz Link to comment https://forums.phpfreaks.com/topic/34433-documentgetelementsbytagname1-is-null-or-not-an-object-error/#findComment-162155 Share on other sites More sharing options...
emehrkay Posted January 17, 2007 Share Posted January 17, 2007 <form id="somethingUnique"><input id="somethingUnique2 /> Link to comment https://forums.phpfreaks.com/topic/34433-documentgetelementsbytagname1-is-null-or-not-an-object-error/#findComment-162763 Share on other sites More sharing options...
bibby Posted January 22, 2007 Share Posted January 22, 2007 get[b]Element[/b]ByTagName() , not the plural Link to comment https://forums.phpfreaks.com/topic/34433-documentgetelementsbytagname1-is-null-or-not-an-object-error/#findComment-165979 Share on other sites More sharing options...
mainewoods Posted January 22, 2007 Share Posted January 22, 2007 --if you are not using 'document.getElementsByTagName' then what is the error message you are getting? Link to comment https://forums.phpfreaks.com/topic/34433-documentgetelementsbytagname1-is-null-or-not-an-object-error/#findComment-166705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.