Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

calling link in other frame

 
 
Ron Eggler
Guest
Posts: n/a
 
      12-18-2007
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
 
Reply With Quote
 
 
 
 
Dr J R Stockton
Guest
Posts: n/a
 
      12-19-2007
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. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
 
Reply With Quote
 
 
 
Reply

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 starman7@hotmail.com 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



Advertisments