Jump to content

innerHTML values to access database?


mbarnhizer
 Share

Recommended Posts

I'm Working with Hypercosm. I have an online application that will appear somewhat like a configurable shopping cart when i'm done. The following code is used to extract from the applet the cost of the selected configuration the viewer selects. I am hoping to figure out how to capture their configuration and put it into my database along with their user information.function getText(text, color, bold) { var html = ""; // add opening text tags // if (color) html += "<font color='" + color + "'>"; if (bold) html += "<strong>"; html += text; // add closing text tags // if (bold) html += "</strong>"; if (color) html += "</font>"; return html;}function getTableColumn(contents, alignment) { if (alignment) var html = "<td align='" + alignment + "'>"; else var html = "<td>"; html += contents; html += "</td>"; return html;}function getTableRow(description, cost, color, bold, alignment) { // create new row // var html = "<tr>"; // add column for description // if (alignment) var columnAlignment = alignment; else var columnAlignment = "left"; html += getTableColumn(getText(description, color, bold), columnAlignment); // add a column for the cost // if (alignment) columnAlignment = alignment; else columnAlignment = "right"; html += getTableColumn(getText(cost, color, bold), columnAlignment); // finish table row // html += "</tr>"; return html;}function getItemizedCost() { var applet = window.opener.appletInterface.applet; var html = "<table width='85%' border='1' cellspacing='0' cellpadding='4'>"; // add header to table // html += getTableRow("Description", "Cost", "#000000", true, "center"); // add base cost // var cost = 2400; html += getTableRow("Starting Partitions", 2400 + ".00") // add right raised round bar // if (applet.layerVisibility[applet.getLayerIndex("DeskArea")]) { cost += 1200; html += getTableRow("Desk Area", 1200 + ".00"); } // add left raised round bar // if (applet.layerVisibility[applet.getLayerIndex("LookoutDesk")]) { cost += 350; html += getTableRow("Look Out Desk", 350 + ".00"); } // add right round bar // if (applet.layerVisibility[applet.getLayerIndex("Bookcase")]) { cost += 1150; html += getTableRow("Bookshelf near desk", 1150 + ".00"); } // add left round bar // if (applet.layerVisibility[applet.getLayerIndex("2ndBookcase")]) { cost += 1150; html += getTableRow("2nd Bookshelf", 1150 + ".00"); } // add umbrella // if (applet.layerVisibility[applet.getLayerIndex("ComputerCabnet")]) { cost += 199; html += getTableRow("Computer Cabnet", 199 + ".00"); } // add back splash // if (applet.layerVisibility[applet.getLayerIndex("Computer")]) { cost += 499; html += getTableRow("Computer", 499 + ".00"); } // add cost to table // html += getTableRow("Total", cost + ".00", "#ff0000"); // finish table // html += "</table>"; return html;} // getItemizedCostfunction computeCost() { // display itemized cost // document.getElementById("cost").innerHTML = getItemizedCost();} // computeCostAny suggestions how i can capture this data? Thanks to all....mike

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...