Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > calling link in other frame

Thread Tools

calling link in other frame

Ron Eggler
Posts: n/a

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:

<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);
<body onLoad="time();">

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
Reply With Quote
Dr J R Stockton
Posts: n/a
In comp.lang.javascript message <MME9j.131$pY1.33@pd7urf2no>, Tue, 18
Dec 2007 00:47:40, Ron Eggler <(E-Mail Removed)> posted:

>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.

(c) John Stockton, Surrey, UK. ? Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:>.
<URL:> jscr maths, dates, sources.
<URL:> TP/BP/Delphi/jscr/&c, FAQ items, links.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh one frame from link in another frame? Noozer HTML 0 10-22-2005 09:23 AM
How to update other frame when new document loaded into a frame Jim Cobban Javascript 0 07-31-2005 05:47 PM
target form field in iframe w/in frame from other frame Javascript 2 05-27-2005 10:25 AM
RE: Link Link Link =?Utf-8?B?REw=?= Windows 64bit 0 05-17-2005 12:15 PM
Re: Link Link Link DANGER WILL ROBINSON!!! Kevin Spencer ASP .Net 0 05-17-2005 10:41 AM