• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javascript function for time... need suggestion

 
swapnil paranjape
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have started writing this javascript function for noting time.Now function is supposed to do following

1.I want to write the geneic function for calculating the time.
2.Now suppose one html page is getting rendered (or loaded).
3.Html page contains different elements.(suppose)these elemnts takes time for loading .
4.These elements in html page will call my javascript function .
5.Now my javascript function should note the time at which the element in html page stated loading .
6.Then once the element is completely loaded (rendered ) in html page ,my function should note the end time.
7.Then my javascript function should write startime ,endtime and name of the html page.

My problem is how should i corelate html page and this gereric function.
As soon as element calls my function i am using start variable to note start time.start = new Date()
now the component is in the process of loading in the page.once it is over
i should note the endtime.

now how my javascript function will know the element is loaded completely.?

i know it doent take any time for normal elements to load in page.but in my case suppose elements do take time.
For example
suppose i am using alertbox. now when alertbox will appear i will note startime,when i click ok on alert i should note end time.so the time difference is time required for element to load.

how should I write this generic function which will note starttime ,then wait till element gets loaded then note end time and write that?
or need i do any changes in html page while calling this js function?

can u please give example or code?i was trying to use frame and div tag.
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like this?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic