Of course.  This is essentially a refactoring trick, although Sandy is
correct about accessibility.

If we take the example of drawing a load of images (instead of tables) you
have a JS function similar to:

function drawImage(src) {
document.write('<img src="" + src + '" height="100" width="100"
border="0" alt="">');
}

and to write an actual image use

drawImage('image1.jpg');

Obviously as you expose differences between elements, you need to open up
additional parameters (e.g height, width etc)
This means that your code downloaded to the client is hell of a lot smaller,
but renders in exactly the same way.  It also has the bonus of making a
global change to an element a little easier.

If you take this example and apply it to tables and the like hopefully you
will get what I mean.  Although, one thing to consider is the weight of the
function itself and the calls versus the natural HTML.  E.g In the example
above, if you were to only draw two images, it makes sense to just write the
HTML, but if you were drawing 10,000 you could be potentially saving tens if
not hundereds of kilobytes.

Neil

> -----Original Message-----
> From: Mickael [mailto:[EMAIL PROTECTED]
> Sent: 18 December 2003 11:52
> To: CF-Talk
> Subject: Re: Help with Netscape 4.7
>
>
> This is an interesting Idea.  I really don't have a good
> understanding of _javascript_.  Can you dumb it down for me a little?
>   ----- Original Message -----
>   From: [EMAIL PROTECTED]
>   To: CF-Talk
>   Sent: Thursday, December 18, 2003 6:27 AM
>   Subject: RE: Help with Netscape 4.7
>
>
>   One thing we commonly do is render tables with _javascript_.
>
>   Create a _javascript_ function that draws (via
> document.write()) a table row
>   with all the dynamic bits of the row as parameters of the
> function.  In your
>   table ensure that you use pixel spacers (maybe in a second
> row 1px high) and
>   the like to maintain the columns (as each row is a
> different table). Then,
>   when you want to draw the table just call the _javascript_
> function with your
>   parameters.
>
>   Not only will this make it render faster as you are using a
> different table
>   for each row, but it will also significantly reduce the
> weight of the page.
>   (by virtue of changing all that table code printed many
> times, to lots of
>   low weight js function calls).
>
>   For an example (admittedly with only six rows per page)
> take a look at the
>   results list on http://www.usedvehicles.landrover.co.uk and the
>   f_drawStockItem() function.
>
>   HTH
>
>   Neil
>
>   > -----Original Message-----
>   > From: Mickael [mailto:[EMAIL PROTECTED]
>   > Sent: 17 December 2003 21:08
>   > To: CF-Talk
>   > Subject: Help with Netscape 4.7
>   >
>   >
>   > Hello All,
>   >
>   > I have a client that uses Netscape 4.7 over their corporate
>   > lan and they access certain reports in an application that I
>   > had built for them.  Unfortunately upgrading them to IE is
>   > not an option.  
>   >
>   > The problem I have is a certain report produces a table, and
>   > depending on their criteria it can be a very long table (even
>   > 1000 rows) where IE will display the info to the screen
>   > Netscape chokes on it.  What happens it that Netscape appears
>   > to be not responding, but actually if you walk away and don't
>   > touch the PC the table will eventually appear.
>   >
>   > I know that Netscape does not display the table until it is
>   > finished loading it completely, so I thought I would try
>   > instead of displaying rows I would display one row tables
>   > instead, this is not working out either as I am having a hell
>   > of a time getting the columns to Line up.
>   >
>   > If anyone could point me in the right direction it would be
>   > greatly appreciated.
>   >
>   > Mike
>   >
>   >
>   >
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to