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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:20:24+00:00 2026-06-05T20:20:24+00:00

hello everyone I am trying to make a script that steps through a list

  • 0

hello everyone I am trying to make a script that steps through a list and appends a score to each record returned by the query. this code below is what’s happening in PHP; a input is created where I store the number that’s going to be processed in a string; below that there is a span element that displays the text score and another span that contains the actual score. Finally there’s an echo that showcases the values generated which look like: score_pad0, score_pad1, score_pad2

echo "<input type='hidden' id='fetch_array' value=".$score_board." />";
echo "<span>score: </span><span id='score_pad$score_board'></span><br />";
echo "score_pad$score_board";

I want to grab the value from fetch_array in javascript. I use the following code for that
var array_id = document.getElementById('fetch_array'); this however returns null when I run it. What am I doing wrong? I’ve tried to read it out by adding the .value extension. but it only crashed my javascript code.

the onload event is triggered by the a function

function initialize(numbers_rows)
{
for(var i=0; i < numbers_rows; i++)
{   
    var node=document.createElement("span");
    node.id="scoreLabel";
    document.getElementById("score_pad"+array_id).appendChild(node);
}
}
  • 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-06-05T20:20:25+00:00Added an answer on June 5, 2026 at 8:20 pm

    There is a possibility that the time your javascript code gets executed your DOM might not be ready. As a trial do <body onload='myFunction()'> and wrap your document.getElementById inside myFunction()

    If does work incase you wish to have multiple handlers for onload event you need to use
    addEventListener DOC for non IE browsers and attachEvent for IE.

    If you could use jQuery then wrap your javascript code around

    $().ready(function () {
     // Your Code Goes here &Will be executed after DOM is ready
    });
    

    Check this question on SO

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

Sidebar

Related Questions

Hello everyone I'm trying to make a flash uploader. The issue however that has
Hello everyone I've been trying to put some objects in an ASP.NET list box
hello everyone im trying to create this tweak that copies a file from one
Hello everyone I am trying to make since of what I am doing wrong
Hello everyone I have a question... I'm trying to make my sms faker app,
Hello everyone it's been some days that I use sql to make analysis and
Hello everyone i need some help. I'm trying to make an application for mac
hello everyone I'm trying to write function which can unfold int in the list
Hello everyone I'm trying to make a jquery Menu just like the one in
Hello everyone. I am trying to develop a Jquery plugin following the steps I

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.