Thursday 15 August 2013

Displaying Javascript Array in pre-coded HTML? -


I need to display a list of 100+ football player numbers, names, weight, ages and heights. I would not like to copy / paste the same exact div to install it and manually change them. I was wondering if there is a way to display each set of data in the already coded html layout? The only thing I can find on Google is Javascript, it creates its table. Here's an example:

Here's the array:

  var playerArray = [ ["# 25", "Player 1", "Weight 1", "Height 1", "Age 1" "1"], ["# 99", "Player 2", "Weight 2", "Height 2" , "Age 2", "Status 2"], ["# 77", "Player 3", "Weight 3", "Height 3" "3," "Position 3"], ["# 63", "Player" 4 "," Weight 4 "," Height 4 "," Age 4 "," Position 4 "], [" # 43 "," Player 5 "," Weight 5 "," Height 5 "," Age 5 " "Position 5"],];   

And here's my html where I want to display data:

  & lt; Div class = "rosterlist" & gt; & Lt; Div class = "p_name" & gt; [[NUMBER]] & lt; Span class = "light_text2" & gt; / [[NAME]]  / Span & gt; & Lt; / Div & gt; & Lt; Div class = "roster_line_2" & gt; Div class = "p_pos" & gt; [[POSITION]] & lt; / Div & gt; & Lt; Div class = "p_height" & gt; [[HEIGHT]] & lt; / Div & gt; & Lt; Div class = "p_grade" & gt; [[AG]] & lt; / Div & gt; & Lt; Div class = "p_weight" & gt; [[WEIGHT]] & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

If this is not possible, just let me know and I will be able to copy and paste it: (

No comments:

Post a Comment