/    Sign up×
Community /Pin to ProfileBookmark

Query Instead of Array???

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#__;”>&nbsp;__#PROPERTIESNAME#__</span></td><td class=”CellSplitter” width=1 onmousedown=”StartResizing()”></td><td class=”Value”><span style=”font-family: __#@font#__; font-size: __#@fontsize#__;”>&nbsp;__#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#__;”>&nbsp;’ + 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();[/code]

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]http://www.cbeckserver.com/view.jpg[/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[/COLOR]

Thanks for the help
Chris

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @cjbeck71081 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...