Well, the delay happens because the script waits for the page to finish loading (the document.ready state) before changing the color of the table.
You could work around this by inserting the script on the next line that the table is made.
So you would have something like this:
And, while it wouldn't completely eliminate a delay, it would come very close to it.Code:<table width='400' border='1' id='table_id'> <tr> <th scope='col'>ID #1: $id1</th> </tr> </table> <script type="text/javascript">document.getElementById('table_id').style.backgroundColor = '<?php echo $bg2; ?>'; </script>



Reply With Quote



Bookmarks