calling link in other frame

Discussion in 'Javascript' started by Ron Eggler, Dec 18, 2007.

  1. Ron Eggler

    Ron Eggler Guest

    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
    Ron Eggler, Dec 18, 2007
    #1
    1. Advertising

  2. In comp.lang.javascript message <MME9j.131$pY1.33@pd7urf2no>, Tue, 18
    Dec 2007 00:47:40, Ron Eggler <> 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.
    Dr J R Stockton, Dec 19, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Søren M. Olesen
    Replies:
    0
    Views:
    576
    Søren M. Olesen
    Nov 13, 2003
  2. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    818
    Kevin Spencer
    May 17, 2005
  3. Noozer
    Replies:
    0
    Views:
    2,998
    Noozer
    Oct 22, 2005
  4. Replies:
    2
    Views:
    189
  5. Jim Cobban
    Replies:
    0
    Views:
    120
    Jim Cobban
    Jul 31, 2005
Loading...

Share This Page