[thelist] Very nice trick to save bandwidth.
Ryan Finley
RyanF at SonicFoundry.com
Fri Jun 8 13:33:52 CDT 2001
At my day job, I work on www.acidplanet.com for Sonic Foundry.
Recently, I tried a new trick on the front page of our "Lounge".
Compare the sizes of the following:
http://www.acidplanet.com/Lounge/lounge.asp
(122k)
http://www.acidplanet.com/Lounge/lounge_javascript.asp
(28k)
Using javascipt to render the repeating tables client-side has made quite
the difference!
This is a nice tip...
<tip type="javascript">
If you have repeating elements in a page (such as rows in a table), consider
mading the repeating element into a function, and then calling that function
repeatably from client-side script. Simply pass the unique elements as
parameters to your function.
If you have a lot of repeating elements, you will save a TON of bandwidth.
Example:
<table>
<tr>
param1...param2
</tr>
</table>
Becomes:
function tr(param1, param2) {
document.write("<tr>" + param1 + "..." + param2 + "</tr>");
}
<table>
<script>
tr(param1, param2);
</script>
</table>
</tip>
Ryan Finley
President - SurveyMonkey.com (http://www.surveymonkey.com)
More information about the thelist
mailing list