This is a peice of code part of a very intricate program that uses ASP, PHP, AJAX and JAVASCRIPT… i have copied out a selection of code, that i want to change, or get more information out of. I will put in notes to try to help grasp what the code does.
[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++)
{
//CODE I WOULD LIKE TO CHANGE START
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>’
}
//CODE I WOULD LIKE TO CHANGE END
code += ‘</table>’;
}
var content = document.getElementById(“Content”);
content.innerHTML = code; //SAFARI
OnResizeGrid();
There is much more to this code than what is show here, but for the sake of making thing simple i included and highlighted the code that is bugging me.
Essentially what this code does is take a selection set, pass it to this javascript code module and make this module array the properties of the selection set, and populate an HTML table with the results… looks like this:
[IMG]
Where the blue line is the slection set and the Property box is populated with the information.
What i would like to do is modify the code so it is no longer an array but some kind of query, so i can assign variables to the values of each property and write my own codes with expresssions and such.
For example instead of a table with NAME and VALUE i would have a table that said Pipe Diameter = [COLOR=Navy]variable
Thanks for the help
Chris