Hi
I defined a new array called “arrStgy” which gets all strategy names from xml doc. This is a one dimensional array with strategy name.
But I want to populate my select box with a two dimensional array with both values being same for option text and option value.
My code does not work now because I have a one dimensional array.
How can i do this?
arrStgy = new Array();
var i = 0;
<xsl:for-each select=”//Class/Master/Strategies”>
arrStgy[i] = ‘<xsl:value-of select=”name”/>’
i = i + 1;
</xsl:for-each>
function getStgy()
{
ccySelected = document.forms[0].Id_ccy[document.forms[0].Id_ccy.selectedIndex].text;
n = new Array();
strategy = new Array();
var count = 0;
for(var j=0; j < arrStgy.length; j++)
{
var strStgy = arrStgy[j];
var strCurrency = strStgy.substring(0,strStgy.indexOf(“#”));
var strStgyCcy = strStgy.substring(strStgy.indexOf(“#”)+1);
if(ccySelected == strCurrency)
{
strategy[count] =strStgyCcy;
count++;
ccyStgy = (strStgy);
fill( form.selectbox, ccyStgy );
}
}
}
function fill( sel, ar )
{
var ix;
for ( ix = sel.options.length-1; ix >= 0; –ix )
sel.options[ix] = null;
for ( ix = 0; ix < ar.length; ++ix )
sel.options[ix] = new Option( ar[ix][0], ar[ix][1] );
}