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);
}
}