Javascript/Html/Css Random background-image & Word from two javascript array
<p>Welcome to the forums!
Today I wanted to code a bit in language Javascript/html/css/php but I stuck in a problem.
(I have searched for this problem everywhere,but no results.)</p>

<p>My problem is => I have two array in my js file. The first store the pictures from the directory,and the second one is store the words that I want to select randomly by Math() number #indexes
You can read everything in my codes. I have commented them.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>window.onload = chooseGame;

var cGamePic = new Array("football.jpg","baseball.jpg");
var cGameName = new Array("football","baseball");
function chooseGame;
 var rnd_num = Math.floor(Math.random() * cGamePic.length);
 document.getElementById("comp1Game").src = cGamePic(rnd_num);
    document.getElementById("??").?? = cGameName(rnd_num);</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Random pics&lt;/title&gt;
  &lt;script src="rnd.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;div id="container1"&gt;
   &lt;h1&gt;Some text 1&lt;/h1&gt;
   &lt;!--The next line will be displayed,but not randomly.
   And I want it to the left-side of screen,as background image.
   Like: the text "Some text 1" will be displayed in the random selected image.
   (The some text 1 is selected randomly too,as "football")
   --&gt;
    &lt;img src="res/images/football.jpg" id="comp1Game" alt="Compare1"&gt;
  &lt;/div&gt;
 
  &lt;div id="container2"&gt;
   &lt;h1&gt;Some text 2&lt;/h1&gt;
   &lt;!-- The future container to see the 2nd selected image &amp; word in it (right side of screen)
   Like,if js select number 6,the word and image will be "baseball" and "baseball.jpg"
   Shortly,I want to do it.
   --&gt;
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;</code></pre>
</div>
</div>
</p>