469,573 Members | 1,666 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

calling link in other frame

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
Dec 18 '07 #1
2 1205
Ron Eggler said the following on 12/17/2007 7:47 PM:
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:
No DOCTYPE.
<html><head>
<script language="JavaScript" type="text/JavaScript">
Drop the deprecated language attribute and keep the comical type
attribute. Validating would have let you know that.
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 + "";
Don't post PHP code. Post the HTML the browser gets.
setTimeout("zeit()", 1000);
Where is the function zeit() defined?
}
</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
Probably because it isn't defined in the code you posted.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 18 '07 #2
In comp.lang.javascript message <MME9j.131$pY1.33@pd7urf2no>, Tue, 18
Dec 2007 00:47:40, Ron Eggler <NO*****@example.composted:
>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.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Dec 19 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Twinkletoes | last post: by
3 posts views Thread by Dennis M. Marks | last post: by
36 posts views Thread by Peter Brause | last post: by
1 post views Thread by Aki | last post: by
6 posts views Thread by zino | last post: by
15 posts views Thread by dspfun | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.