View Full Version : Page Loading Time
12-30-2004, 07:30 PM
I've also put it below -
var from_time = new Date();
from_time = from_time.getTime();
var to_time = new Date();
to_time = to_time.getTime();
var secs = (to_time - from_time) /1000;
I would like to write the text in part of the page but I can't do it...
I tried - <script>document.write(secs)</script> but it says secs is undefined.
12-30-2004, 07:36 PM
Try putting an onload event calling your function, also put document.write(secs) in your function.
12-30-2004, 07:52 PM
I've done the onload etc, but I want the time to be written in a specific place.
12-30-2004, 07:55 PM
I guess i'm confused, if you have it in a function like you do, you'll have to call the function somehow. Maybe you can explain in more detail. :)
12-30-2004, 08:14 PM
OK, the function goes in the head, when the onLoad event is triggered, the function is run calculating the page load time. I wish to display the output of that (secs) somewhere in the text in my page. :)
12-30-2004, 09:00 PM
I see, well then your not going to want to use document.write(), you're gonna want to use a div, or something of that matter, and write the seconds in there or you can do it like the example page you posted up where they have it in a text box.
12-30-2004, 09:30 PM
Hmm, I'd rather not use a text box as I want it in the actual text.... there must be a way? :S I'll keep trying!
12-30-2004, 09:33 PM
I see, well then your not going to want to use document.write(), you're gonna want to use a div, or something of that matter
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.