calling link in other frame

R

Ron Eggler

Hi,

I would like to call a link in a frame every second but with a different GET
parameter to recognize the time, how long a user has been on the page, i
did this with following script:

<html><head>
<script language="JavaScript" type="text/JavaScript">
var start = new Date();
function time()
{
var now = new Date();
seconds=parseInt((now.getTime() - start.getTime()) / 1000);
parent.nullframe.location = "nullframe.php?email=<?php echo
$_SESSION['email'] ?>&duration=" + seconds + "";
setTimeout("zeit()", 1000);
}
</script>
</head>
<body onLoad="time();">
</form></body></html>

The error console gives no errors, so it seems to be good but somehow it
loads the page once only and the setTimeout("zeit()", 1000); call doesn't
seem to call
 
D

Dr J R Stockton

Tue said:
seconds=parseInt((now.getTime() - start.getTime()) / 1000);

You should use Math.floor, not parseInt, there. Or you could use |0.
The two .getTime() are OK but superfluous.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top