I am interested in taking the results of an Array and assigning variables to them. The code below highlighted in red populates an HTML table with the results of an array for two properties…. one is properties.name, and the other is properties.value….. i would like to have variables for these resulting values so i can use them in different ways.
For example, there are two polygons, one has the properties of size=12, color=red, and sides=4
the second box has properties of size=25, color=blue, sides=8 and name=octogon
When the code runs the array it merely checks each polygon for the number of properties and lists them into an HTML table….
[B]HTML TABLE POLYGON 1
[I]Name[I]Value
Size 12
Color Red
Sides 4
[B]HTML TABLE POLYGON 2
[I]Name[I]Value
Size 25
Color Blue
Sides 8
Name Octogon
I would like to create variables for each of those values so that i can utilize them in my own expressions…. i.e.
I could use HTML to write “This Polygon has a size of var1=[i][COLOR=Green]12[i][COLOR=Green]Blue[i][COLOR=Green]8[i][COLOR=Green]Octogon
resulting in the text “This polygon has a size of 12 and its color is blue. Because it has 8 sides it is an octogon.
[code=php]
function SetProperties(count, properties) {
var code;
propCount = count;
if(count != 1)
{
var text;
if(count == 0)
text = “__#PROPERTIESNONE#__”;
else
text = GetMainFrame().FormatMessage(“__#PROPERTIESITEMSEL#__”, new Array(count, “unused”));
code = ‘<table id=”Grid” cellspacing=0 cellpadding=0 border=0><tr><td class=”Info” align=”center”>’ + text + ‘</td></tr></table>’;
}
else
{
code = ‘<table id=”Grid” cellspacing=0 cellpadding=0 border=0><tr class=”Header”><td id=”Name” class=”Name” width=65><span style=”font-family: __#@font#__; font-size: __#@fontsize#__;”> __#PROPERTIESNAME#__</span></td><td class=”CellSplitter” width=1 onmousedown=”StartResizing()”></td><td class=”Value”><span style=”font-family: __#@font#__; font-size: __#@fontsize#__;”> __#PROPERTIESVALUE#__</span></td></tr>’;
for(var i=0; i < properties.length; i++)
{
[COLOR=DarkRed]code += ‘<tr class=”GridCell”><td><span style=”font-family: __#@font#__; font-size: __#@fontsize#__;”> ’ + properties[i].name + ‘</span></td><td></td><td><span style=”font-family: __#@font#__; font-size: __#@fontsize#__;”>’ + properties[i].value + ‘</span></td></tr>'[/COLOR];
}
code += ‘</table>’;
}
var content = document.getElementById(“Content”);
content.innerHTML = code; //SAFARI
OnResizeGrid();
I appreciate any help with this, it seems im sure of what i want to do, just not of how to execute it.
Thank You
Chris