Click to See Complete Forum and Search --> : Page Renders Very Slow


lesamiller
04-01-2008, 08:46 AM
I have a web page that shows grids, each grid represents time in 1/2 hour increments. Each grid can be clicked on to schedule time on a machine, I added onmousedown to know what time the user has selected to schedule time. The problem is when the page loads it's very slow. I've tried putting a div inside the TD and changing the onmousedown to onclick and nothing has helped. Anyone have advice? I can't change the screen since the layout is a requirement from the customer.

Fang
04-01-2008, 09:12 AM
Don't use tables for layout.
Add event handlers after the page has loaded.

WebJoel
04-06-2008, 05:14 PM
Can you paste some code to look at?

svivian
04-09-2008, 06:58 AM
Actually, tables are the proper way to display tabular data such as data grids. If you have a lot of table cells than that could be the cause of the problem (and changing to div's won't make anything faster).

Another thing that often slows table loading is using numerous attributes on each table cell (eg <td align="left" valign="top" bgcolor="red" ...>). You might be able to improve speed by applying a few CSS rules to the whole table instead.

And, of course, providing us with a sample page would help!!

toicontien
04-09-2008, 10:07 AM
... (and changing to div's won't make anything faster). ...
In actual time elapsed, it will make a small difference. In perceived performance, it will make a huge difference. Tables are rendered one row at a time. DIVs, as well as any other block and inline elements, are rendered gradually as their contents are downloaded. DIV based layouts seem to render quicker because the page progressively displays. Table base layouts, which often the entire page is in one table cell, seem to take longer because a whole row will be displayed only after all its contents have been downloaded.

So yes, changing to a non table based layout (not necessarily DIV-based) will speed up both actual and perceived rendering, however, if the data is truly tabular data, then use a table. Put as much of the styling in CSS files as you can to cut down on the shear file size of the HTML file. As mentioned earlier too, run all the necessary JavaScript in the onload event instead of scattering SCRIPT tags in the BODY. SCRIPT tags in the BODY also slows rendering down because once the browser encounters a SCRIPT tag, it must stop page rendering and execute the JavaScript to ensure the JavaScript doesn't change the DOM, and then the display of the page, before the browser continues rendering the page.