C
L
O
S
E
3
|
2007-10-04-14-52
This file
http://freeman2.com/saytime2.htm
was written in Chinese first. Document 1 was in
Chinese. English version has document 2 and 3.
Document 2 use hidden box to store begin/end time.
Document 3 use js variable to store begin/end time.
Since hidden box is external to Javascript, so
hidden box method is slower.
Freeman is not a programming expert, learn from
experiment/error. When write document 2, I am not
sure if global variable defined at file beginning
is still valid at file end. Since in between,
browser load text and picture. Javascript stopped
during this period.
On 2007-10-03-19-46 do experiment, use variables
and discard hidden box.
On 2007-10-03-19-50 confirmed variables work.
This version should be a little bit faster.
If you want to use elpase code in your web page,
please do as following:
1. create a set of variables
var elap1end,elap1bgn;
to record begin/end time.
Because the time difference equation is
elap1end-elap1bgn
so I use elap1end,elap1bgn;
not use elap1bgn,elap1end;
2. write code to record beginning time
save time to variable "elap1bgn"
elap1bgn //9610032043 time label is for search
=saytime(203);
3. elapse time required code follows immediately
your code is here.
4. write code to store end time to variable
"elap1end"
elap1end=saytime(203); //9610032046 time label is for search
5. calculate time difference
document.write(
'<br><font color=red>run first codes elapse time is '
+(elap1end-elap1bgn)/1000
+' seconds<br></font>');
The end time has larger number,
The begin time has smaller number,
Above 'elap1bgn' and 'elap1end' can be
other name. But must be consistent.
If you have second group code need to observe,
create another set variables, change '1' to '2'
'elap2bgn' and 'elap2end' must enclose the
observed codes.
Your file should have next two function
definitions
function getdigit(inDigit){.....}
function saytime(type0){.....}
They must be defined before use. It is better
to define function in <head>
(elap1end-elap1bgn) get milliseconds
(elap1end-elap1bgn)/1000 change to seconds.
2007-10-04-15-21 here
This file use four set elapse time measurements.
1. whole file load time
Beginning time record
elap1bgn //9610032043
=saytime(203)
;
ending time record
elap1end=saytime(203); //9610032046
after run, two variables has value like
elap1bgn=1191525755328 page start
elap1end=1191525755593 page done
above long digits is from Chinese version.
English version should have shorter elapse
time. Since English version has less task.
To report the elapse result, use next code
document.write(
'<br><font color=red>Load this file, elapse time: '
+(elap1end-elap1bgn)/1000
+' seconds.<br>Seconds is the answer of "wait how long".<br>'
+'Picture load is not counted.</font> 9609132023<br>'
);
2. second set elapse code is announcement header code
that is rocsitee.js
to record start time
<SCRIPT language=JavaScript>
elap5bgn=saytime2(203); //9610032138
</SCRIPT>
to run announcement header code
<script src=
http://freeman2.com/rocsitee.js
> </script><!--9610011318 add-->
to record end time
<SCRIPT language=JavaScript>
elap5end=saytime2(203); //9610032139
</SCRIPT>
to calculate and report the result
document.write(
'<font color=red>To run announcement header code elapse time is '
+(elap5end-elap5bgn)/1000
+' seconds<br></font>');
3. third set elapse code is to measure ten
Miss Deng's picture code elapse time
to record start time
<SCRIPT language=JavaScript><!--
elap2bgn //9610032054
=saytime2(203);
//--></SCRIPT>
there are about 70 lines picture display code.
to record end time
<SCRIPT language=JavaScript><!--
elap2end //9610032055
=saytime2(203);
//--></SCRIPT>
to calculate and report the result
document.write(
'<font color=red>To run ten Miss Deng's picture code elapse time is '
+(elap2end-elap2bgn)/1000
+' seconds<br></font>');
4. mouse pointer cross Miss Deng's picture elapse time.
to record start time
onmouseover='elap3bgn=saytime2(203);'
to record end time
onmouseout='getelapse(10)'
this command call function 'getelapse(10)'
with parameter '10' which indicate mouse
pointer crossed picture number ten.
in 'getelapse(10)' record the end time
as following.
function getelapse(type0)
{
elap3end=saytime2(203); //9610032121
.....
}
to calculate and report the result
document.getElementById("dengljun").innerHTML=
'<font color=red>You have touched Miss Deng picture '
+number0[type0]
+' for '
+(elap3end-elap3bgn)/1000
+' seconds.<br>';
Except the mouse pointer movement report, all other
three elapse time is reported at the end of file.
2007-10-04-16-08
2007-10-04-16-34
Hidden box in web page still be there.
But code to read and to write to hidden boxes
was deleted by '///'
///document.getElementById("record02Bgn").value
2007-10-04-16-35
|
|