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

  • Home
  • SEARCH
  • 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 6892875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:35:20+00:00 2026-05-27T06:35:20+00:00

PROBLEM This works if I take out the comment //document.getElementById(‘formtimer’).innerHTML = TimeStr; // Shows

  • 0

PROBLEM

This works if I take out the comment

    //document.getElementById('formtimer').innerHTML = TimeStr; // Shows 00:15:00

Works wonderfully. So, I comment that out and…

I wanted to make a graphical counter so I went into Photoshop and made 0-9 and tried this…

var imgCounter = document.getElementById('formtimer');
imgCounter.src = "graphics/odometers/white and blue with black background/1.png";

When the 1 was never drawn I put this in the HTML (just in case I had to have a picture already there)…

<td class="tbl_col1"><div align="right" id="formtimer"><img src="graphics/odometers/white and blue with black background/0.png" /></div></td>

SO… it draws a 0 on the screen, and the javascript should change it to a 1. I thought the path was incorrect so I played with that. I even copied the below code from another function (that works) to here – and it didnt work (the original ID for the “other” working code was different. I changed it to ‘formtimer’ when I copied it into this non-working script.

var img_sad = "graphics/signup/smiley-sad006.gif";
var imgUsername = document.getElementById('formtimer');
imgUsername.src = img_sad;

I’m confused why the innerHTML works fine, and my graphics don’t work. I tried debugging in Firebug and no errors appear.

Please and thank you once again!

  • 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-27T06:35:20+00:00Added an answer on May 27, 2026 at 6:35 am

    document.getElementById('formtimer'); gets the <div> element and imgCounter.src = "..." sets the src attribute of the <div>, which has no meaning.

    You should get the <img> element instead. You can do this using the firstChild property or adding an id to the <img> element.

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

Sidebar

Related Questions

Please can anyone help me out with this problem? This code below works perfectly
Never thought I'd have this problem :) The following snippet of code works in
I've got a problem with this embed in Safari. It works just fine on
Here's the problem: split=re.compile('\\W*') This regular expression works fine when dealing with regular words,
I have a problem: if i run this test in NUnit ,it works Board
I have a Firefox 3.6.2 problem (3.5.x works just fine). This is the code:
Problem This question actually came up at work today. We are planning an experiment
This problem may seem like school work, but it isn't. At best it is
This problem crops up every now and then at work. Our build machine can
I have problems running a dynamic LIKE statement in my project: this query works

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.