InnerHTML problem in IE8 and below

I am editing code from a previous developer for a schedule filtering system. As I dealt with this myself, I use jQuery, so I have a few questions debugging this problem. There seems to be a problem with Javascript in IE.

Here is the code where the problem occurs:

Javascript:

if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("showtimetable").innerHTML=xmlhttp.responseText; jQuery('div #moreInfo a').each(function() { var $link = jQuery(this); var $dialog = jQuery('<div></div>') .load($link.attr('href') + ' #content') .dialog ({ autoOpen: false, title: $link.attr('title'), width: 600 }); $link.click(function() { $dialog.dialog('open'); return false; }); 

And the markup:

 <div id="showtimetable"> <table class="tidytable"> <thead> <tr> <th width="20%"> Venue </th> <th width="18%"> Session </th> <th width="18%"> Age </th> <th width="15%"> <?php echo JText::_('COM_TIMETABLE_HEADING_GROUP'); ?> </th> <th width="10%"> <?php echo JText::_('COM_TIMETABLE_HEADING_WEEKDAY'); ?> </th> <?php /*<th width="13%"> Activity </th>*/ ?> <th width="14%"> Time </th> <th width="5%"> Info </th> </tr> </thead> <tfoot> <tr> <td colspan="13"> <?php //echo $this->pagination->getListFooter(); ?> </td> </tr> </tfoot> <tbody> <?php foreach($this->items as $i => $item): ?> <tr class="row<?php echo $i % 2; ?>"> <td> <?php if($item->centreDescription!=''){echo '<a href="'.$item->centreDescription.'" >'.$item->centre.'</a>';} else {echo $item->centre;}?> </td> <td> <?php echo $item->class;?> </td> <td> <?php echo $item->ageRange;?> </td> <td> <?php echo $item->gn;?> </td> <td> <?php TimeTablesHelper::getWeekday($item->weekday);?> </td> <?php /*<td> <?php echo $item->activity; ?> </td>*/?> <td> <?php echo substr($item->startTime,0,5); ?> - <?php echo substr($item->endTime,0,5); ?> </td> <td width="5%"> <?php if($item->bookingInfo!=''){?> <div id="moreInfo"> <a href="moreinfo.php?id=<?php echo $item->id;?>" title="More Details...">+</a> </div> <?php }?> </td> </tr> <?php endforeach; ?> </tbody> </table> 

Here is the xml answer:

 <form action="/component/timetable/" method="post" name="adminForm"> <table class="tidytable"> <thead> <tr> <th width="20%"> Venue </th> <th width="18%"> Session </th> <th width="18%"> Age </th> <th width="15%"> Group </th> <th width="10%"> Weekday </th> <th width="14%"> Time </th> <th width="5%"> Info </th> </tr> </thead> <tfoot> <tr> <td colspan="13"> </td> </tr> </tfoot> <tbody> <tr class="row0"> <td> Heywood Civic Centre </td> <td> 50+ Bowls </td> <td> Aged 50 plus </td> <td> 50 Plus </td> <td> Thursday </td> <td> 13:00 - 16:00 </td> <td width="5%"> <div id="moreInfo"> <a href="/moreinfo.php?id=303" title="More Details...">+</a> </div> </td> </tr> </tbody> </table> <input type="hidden" name="task" value="" /> </form> 

This works fine in Firefox and IE9, but in IE8 and below I get SCRIPT601: unknown time classes for error execution, line 564 character 7, which refers to a line in javascript using the innerHTML function.

I'm not sure why this problem may occur, but it interferes with Javascipt.

Does anyone know why this is happening?

Thank you very much in advance!

+4
source share
2 answers

This error occurs if you do not follow the recommendations of the W3C tag. IE is very picky about this, but Firefox is not. You can read here: http://blog.rakeshpai.me/2007/02/ies-unknown-runtime-error-when-using.html

Here is a similar question that may help you: Fix and unknown runtime error in IE8

Here is another link to the same thing, and in particular the question "form in form": http://jadendreamer.wordpress.com/2009/06/02/internet-explorer-fix-unknown-runtime-error-using-innerhtml -ajax /

+6
source

Have a look here: http://blog.rakeshpai.me/2007/02/ies-unknown-runtime-error-when-using.html

It seems that IE will throw this error when you try to insert html that it doesn't like. What is in xmlhttp.responsetext ? Are you trying to add tr or td directly below the div , maybe?

+1
source

All Articles