javascript selecting an array in a function
<p>I want to be able to select from multiple sets of data using a select dropdown. All my code looks for one variable to pull the data from the selected array. I have defined my arrays and when I set my variable to use the data from an array it works throughout my code. When I try to change the array in the variable with a function instead of selecting the array the variable is set to the name of the array.</p>

<p>HTML</p>

<pre><code>&lt;select id="panelType" onchange="selectPanel(value)"&gt;
    &lt;option value="S5"&gt;S5&lt;/option&gt;
    &lt;option value="X6"&gt;X6&lt;/option&gt;
    &lt;option value="F4"&gt;F4&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>Javascript</p>

<pre><code>var S5 = [.5, .5, 96, 96, 16.3, 1.05, 0, .5, 3, 0, 0];
var X6 = [.5, .5, 72, 72, 21.2, 1.05, 1, 4, 40, 1, 18.1];
var F4 = [.5, 1, 104, 208, 28.4, 2.05, 1, 2, 17.6, 1, 9];

var pData = X6;
alert(pData[3]);

function selectPanel(pType) 
{
    pData = pType;
    alert(pData[2]);
}
</code></pre>

<p>The first alert returns 208, but the alert in the function returns undefined. If I were to change it to alert(pData); it would return S5 if I selected the first option.</p>