Results 1 to 4 of 4

Thread: help me with this script: Time spent

  1. #1
    Join Date
    Aug 2003
    Location
    kajang
    Posts
    20
    Rep Power
    0

    help me with this script: Time spent

    Can anybody help me to repair this script
    The seconds number too excessive.
    e.g. 3:245

    thanks


    <script>

    <!--


    var entered = new Date()

    function track()

    {

    var now = new Date()

    var seconds = Math.floor((now.getTime() - entered.getTime()) / 1000)

    var minutes = Math.floor(seconds /60)

    var second = seconds % 60

    var minute = minutes % 60

    document.time.timer.value = minutes + ":" + seconds

    var timeID= setTimeout("track()",1000)

    }

    //-->

    </script>

  2. #2
    Join Date
    Jun 2001
    Location
    Mystic Kingdoms
    Posts
    2,749
    Rep Power
    277
    tak jalan pun script ko..

    rajin laaa sket kawan ku... iskk

  3. #3
    Join Date
    Feb 2003
    Location
    Kluang, Johor
    Posts
    2,367
    Rep Power
    249
    well, the script logic is wrong.
    TRY (partial):
    Code:
    var seconds = Math.floor((now.getTime() - entered.getTime()) / 1000) //get different of Entered and Now
    var minute = Math.floor(seconds /60) //get number of minute
    var second = Math.floor(seconds - (minute*60)) //get number of seconds left after minus minutes
    And also, you use wrong variable names in this line:
    Code:
    document.time.timer.value = minutes + ":" + seconds
    I assumes the correct one shoud be like this:
    Code:
    document.time.timer.value = minute + ":" + second
    Try to practice to use more meaningful variable names.
    Hope these help.
    Last edited by lcf; 12-02-2004 at 04:15 PM.

  4. #4
    Join Date
    Nov 2001
    Location
    Johor
    Posts
    772
    Rep Power
    233
    jgn lupa baca signature mysticmind...
    I hate when:

    vBulletin Message:
    Sorry! The administrator has specified that users can only post one message every 60 seconds

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 27-12-2009, 09:57 PM
  2. Matrimonial Script with new feature, shaadi.com clone script
    By sahil101 in forum Website Programming
    Replies: 1
    Last Post: 14-10-2009, 01:23 PM
  3. [WTS]MLM FULL SCRIPT, FULL MLM Script, easy to configure...
    By chardoz in forum Site, Domains and Links Marketplace
    Replies: 1
    Last Post: 10-12-2008, 12:39 AM
  4. How To Convert Shell Script to Batch Script
    By nana86 in forum Website Programming
    Replies: 0
    Last Post: 20-07-2007, 10:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112