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 6868867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:29:13+00:00 2026-05-27T03:29:13+00:00

I don’t understand how to manipulate the DOM very well. I have used document.getElementById(‘someid’).innerHTML

  • 0

I don’t understand how to manipulate the DOM very well. I have used

document.getElementById('someid').innerHTML = "HI";

in other places and it works fine. But when I went to add a timer to my webpage I can’t use the above to change some text (the timer). So… I’m very confused. You have all helped me in other problems I have had… I research lots before bugging you all but I’m stumped & frustrated.

in signupForm.php – SNIPPIT

<title>Perry Computer Services - Signup</title>
<script src="js/commonUtils.js" type="text/javascript"></script>
<script src="js/validation.js" type="text/javascript"></script>
<script src="js/timers.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">window.onload = CreateTimer(30);</script>

in timers.js

function CreateTimer(Time)
{
  alert("Timer created:" + Time);
  document.getElementById('debug1').innerHTML = "WORKS";
  alert("We never get here.");
}

in signupForm.php – SNIPPIT

<form name="form1" method="post" action="signupForm.php?calling_page=validateform" accept-charset="utf-8">
  <table border="0" align="center">
    <tr class="table_top">
      <td class="tbl_col1"><div align="right" id="debug1"></div></td>
      <td class="tbl_col2"><div align="left" id="debug2"></div></td>

Here’s what I’m confused about. I have another .js file called validation.js and I use the exact same document.getElementById as above in there and it works!!! I don’t get it!

In validation.js I modify the DOM a lot and it works great! Is it working because when I change a field by tabbing to the next field is this a SCOPE problem? If someone doesn’t know what I’m doing wrong I’ll try to chop up my validation.js and stick it in here but it’s huge. Why would 1 function work and another one in a different file not work?

  • 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-27T03:29:13+00:00Added an answer on May 27, 2026 at 3:29 am

    You call CreateTimer immediately and assign its return value (undefined) to onload.

    At the time you call it, the element with the specified ID does not exist, and that line errors and stops the script from running any further.

    Assign a function to onload.

     window.onload = function () { CreateTimer(30); };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't overthink this - there's a very commonly used term and I ... have
Don't ask me how but I'm in a situation where I have DCPs published
Don't think that I'm mad, I understand how php works! That being said. I
Don't be frightened, its a very basic code. Just wanted to check with you
Don't they both have to convert to machine code at some point to execute
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't think my virtualhost is working correctly. This is what I have inside of
Don't know where else to ask, but from one day to the other my
Don't ask why but I have the requirement to draw a border around certain
I don't have much knowledge about the IPv6 protocol, so sorry if the question

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.