Click to See Complete Forum and Search --> : Please Look This Over - Hard Script


totle71268
05-14-2003, 10:05 AM
Hello,
I need to create a script that is a calculator and a clock. What I need it to do- is everytime we press enter I need it to record the current time, then when we press enter again, I need it to record that time and subtract away from the time before it. Then take the answer and divide it by 2. So if I pressed enter at 5:48, then presed it again at 5:59, the difference would be 11 minutes so I would get 5.5. I also need to name each time entry with even numbers like this:

1124 hit at 5:48
1126 hit at 5:59 = 5.5
1128 hit at 6:05 = 3
1130 hit at 6:10 = 2.5

I also need these figures to print on command. I know this is a very hard code. If you can help me let me know I would very much appreciate it.
Thank you very much, there may even be some rewards in it.
Have a good day.

Jona
05-14-2003, 11:09 AM
This doens't quite work, but I think it should start you up a little.

var d, h, m;

function timeIt(){
d = new Date();
h = d.getHours();
m = d.getMinutes();
document.forms[0].elements[0].value=h+":"+m;
}

function calcDate(e){
var Evt = (event.which)?event.which:event.keyCode
if(Evt==13){ // if [Enter] was pressed

}
}

document.onKeyDown=calcDate(event);
window.setTimeout("timeIt()", 30000);