File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes javascript function  for time... need suggestion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript function  for time... need suggestion" Watch "javascript function  for time... need suggestion" New topic

javascript function for time... need suggestion

swapnil paranjape
Ranch Hand

Joined: May 15, 2005
Posts: 126
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 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

Joined: Dec 13, 2004
Posts: 429
Something like this?

I agree. Here's the link:
subject: javascript function for time... need suggestion
It's not a secret anymore!