Created
November 10, 2012 23:44
-
-
Save sauntimo/4053019 to your computer and use it in GitHub Desktop.
Build HTML Response Table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ----- 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