views:

26

answers:

1

hi i need to capture the loading time of each http object such as img src="" and script src=""

if it is impossible to loop the http elements, i can build an array and than loop that

i know that i can use firebug, but i need that inside js

thanks

A: 

Something like:

<script>var startTimeForXX = +new Date;</script>
<img src="" onload="calculateEndTime(stateTimeForXX, +new Date);" />

Should do it.

Noon Silk
thanks, but.this way ill have to change my entire website.is there a way listen to "onLoadStarts"?because i can write an out side loop script with out going over the entire HTML.im using Jquery if that helps.Thanks Again!
fatnjazzy
You can use jQuery to attach to all on-load events; but the point is you'll need to start a counter at the writing of each element, to determine exactly how long the specific loading for that one takes. So you're better off doing it as I showed, and using some hashmap to track them all.
Noon Silk