Skip to content

Instantly share code, notes, and snippets.

@sauntimo
Created November 10, 2012 23:44
Show Gist options
  • Save sauntimo/4053019 to your computer and use it in GitHub Desktop.
Save sauntimo/4053019 to your computer and use it in GitHub Desktop.
Build HTML Response Table
/* ----- BUILD HTML RESPONSE TABLE ----- */
var HTMLtable = "<table style=\"border:2px solid black;width:500\" >";
var rowCount = 0;
for (var property in NewSubmission) {
if(NewSubmission[property].length != 0){
if(property.substring(0,7) === "Section"){
HTMLtable += "<tr><th colspan=\"2\" bgcolor=\"#c7ced4\">"+ property +"</th></tr>";
} else {
if(rowCount % 2 === 0){
HTMLtable += "<tr><td>" + property + "</td><td>" + NewSubmission[property] + "</td></tr>";
} else {
HTMLtable += "<tr bgcolor=\"#d0eaf9\"><td>" + property + "</td><td>" + NewSubmission[property] + "</td></tr>"
}
}
rowCount++;
}
}
// don't forget to close your table tags!
HTMLtable += "</table>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment