Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6337041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:10:31+00:00 2026-05-24T19:10:31+00:00

My timer wont display anything, I think it has something to do with the

  • 0

My timer wont display anything, I think it has something to do with the insertBefore function but I am not sure. Any ideas on why it doesn’t display any numbers in my span?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function timeMsg()
{
var t=setTimeout("displayMsg()",5000);
}
function displayMsg()
{
document.getElementById("timeoutmsg").style.display = 'block';
}

COUNTER_START = 60

function tick () {
    if (document.getElementById ('counter').firstChild.data > 0) {
        document.getElementById ('counter').firstChild.data = document.getElementById ('counter').firstChild.data - 1
        setTimeout ('tick()', 1000)
    } else {
        document.getElementById ('counter').firstChild.data = 'done'
    }
}

if (document.getElementById) onload = function () {
    var t = document.createTextNode (COUNTER_START)
    var p = document.createElement ('P')
    p.appendChild (t)
    p.setAttribute ('id', 'counter')

    var body = document.getElementsByTagName ('timer')[0]
    var firstChild = body.getElementsByTagName ('*')[0]

    body.insertBefore (p, firstChild)
    tick()
}

</script>
</head>

<body>
<div id="timeoutmsg" style="border: solid 2px black; background-color: #69F; width: 300px; height: 100px; text-align: center; position: absolute; display: ; left: 40%; top: 40%; z-index: 1;" >Your Session will expire in  <span id="timer"></span> Click Here to Contine or you will be logged out.</div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:10:32+00:00Added an answer on May 24, 2026 at 7:10 pm

    try this http://jsfiddle.net/d4ft4/

    the problem was at this line

    var body = document.getElementsByTagName ('timer')[0]
    

    changing it to

    var body = document.getElementById('timer');
    

    did the trick

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My timer has three variables that I can trace to the output window, but
Not sure why this isn't working. I have a timer defined, which runs a
function Timer() { this.initialTime = 0; this.timeStart = null; this.getTotalTime = function() { timeEnd
Which is the best timer approach for a C# console batch application that has
Please help, I am building a Java applet, and it wont let me display
This code working for me to display the door-hanger popup. But, when I want
Every time I do anything, and my while(1) gets called in my main function,
Its friday, and in local time the clock is 3.22pm, so my brain wont
For some reason This php script won't echo anything: <?php setcookie(pop,'hi',time()+604800); echo $HTTP_COOKIE_VARS['pop']; ?>
A timer is being used in my C# application to determine if an expected

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.