Jump to content

DwnWrdSprl11

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About DwnWrdSprl11

  • Rank
    Newbie
  1. Fixed the quote, but it's still not calculating 😰 <!DOCTYPE html> <html> <head> <style> table { font-family: Arial Narrow, Arial Narrow; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 5px; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> <body> <table style="width:100%"> <tr> <th></th> <th>Interval 1</th> <tr> <td>Ending Depth (TVD)</td> <th><input type="number" id="Interval-1-EndTVD" name="Interval-1-EndTVD" min="0"></th> </tr> <tr> <td>Interval End Mud Weight (lb/gal)</td> <th><input type="number" id="Interval-1-EndMW" name="Interval-1-EndMW" min="0" step="0.01"></th> </tr> <tr> <td>Interval TD Hydrostatic Pressure (psi)</td> <th id="Interval-1-Hydrostatic"></th> </tr> </table> <p></p> <script> var a = "Interval-1-EndTVD"; var b = "Interval-1-EndMW"; function processChanges1() { var val1 = document.getElementByID(a).value; var val2 = document.getElementByID(b).value; //Substitute actual validation here if (val1 > 0 && val2 > 0) { var z = val1 * val2 * 0.52; document.getElementById("Interval-1-Hydrostatic").innerHTML = z; } } document.getElementById(a).addEventListener("change", processChanges1); document.getElementById(b).addEventListener("change", processChanges1); </script> </body> </html>
  2. Ok, i had looked at another approach.. may be even more complex.. but seriously.. i have no idea what i am doing wrong. the best thing to help me is to show me what the full code should look like. I am a super beginner... Just looking at 1 calculation: <!DOCTYPE html> <html> <head> <style> table { font-family: Arial Narrow, Arial Narrow; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 5px; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> <body> <table style="width:100%"> <tr> <th></th> <th>Interval 1</th> <tr> <td>Ending Depth (TVD)</td> <th><input type="number" id="Interval-1-EndTVD" name="Interval-1-EndTVD" min="0"></th> </tr> <tr> <td>Interval End Mud Weight (lb/gal)</td> <th><input type="number" id="Interval-1-EndMW" name="Interval-1-EndMW" min="0" step="0.01"></th> </tr> <tr> <td>Interval TD Hydrostatic Pressure (psi)</td> <th id="Interval-1-Hydrostatic></th> </tr> </table> <p></p> <script> var a = "Interval-1-EndTVD"; var b = "Interval-1-EndMW"; function processChanges1() { var val1 = document.getElementByID(a).value; var val2 = document.getElementByID(b).value; //Substitute actual validation here if (val1 > 0 && val2 > 0) { var z = val1 * val2 * 0.52; document.getElementById("Interval-1-Hydrostatic").innerHTML = z; } } document.getElementById(a).addEventListener("change", processChanges1); document.getElementById(b).addEventListener("change", processChanges1); </script> </body> </html>
  3. So, it's still not working.. what do I have wrong here? I type in numbers in the cells and it doesn't populate the hydrostatic. <!DOCTYPE html> <html> <head> <style> table { font-family: Arial Narrow, Arial Narrow; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 5px; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> <body> <table style="width:100%"> <tr> <th></th> <th>Interval 1</th> <th>Interval 2</th> <th>Interval 3</th> <th>Interval 4</th> <th>Interval 5</th> <th>Interval 6</th> <th>Interval 7</th> </tr> <tr> <td>Ending Depth (TVD)</td> <th><input type="number" id="Interval-1-EndTVD" name="Interval-1-EndTVD" min="0"></th> <th><input type="number" id="Interval-2-EndTVD" name="Interval-2-EndTVD" min="0"></th> <th><input type="number" id="Interval-3-EndTVD" name="Interval-3-EndTVD" min="0"></th> <th><input type="number" id="Interval-4-EndTVD" name="Interval-4-EndTVD" min="0"></th> <th><input type="number" id="Interval-5-EndTVD" name="Interval-5-EndTVD" min="0"></th> <th><input type="number" id="Interval-6-EndTVD" name="Interval-6-EndTVD" min="0"></th> <th><input type="number" id="Interval-7-EndTVD" name="Interval-7-EndTVD" min="0"></th> </tr> <tr> <td>Interval End Mud Weight (lb/gal)</td> <th><input type="number" id="Interval-1-EndMW" name="Interval-1-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-2-EndMW" name="Interval-2-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-3-EndMW" name="Interval-3-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-4-EndMW" name="Interval-4-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-5-EndMW" name="Interval-5-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-6-EndMW" name="Interval-6-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-7-EndMW" name="Interval-7-EndMW" min="0" step="0.01"></th> </tr> <tr> <td>Interval TD Hydrostatic Pressure (psi)</td> <th id="Interval-1-Hydrostatic"></th> <th></th> <th></th> <th></th> <th></th> <th></th> <th></th> </tr> </table> <script> var a = "Interval-1-EndTVD"; var b = "Interval-1-EndMW"; function processChanges1() { var val1 = document.getElementByID(a).value; var val2 = document.getElementByID(b).value; //Substitute actual validation here if (val1 > 0 && val2 > 0) { var z = val1 * val2 * 0.052; document.getElementById("Interval-1-Hydrostatic").innerHTML = z; } } </script> </body> </html>
  4. Let's simplify this.. let's only look at one calculation. I need the entire row calculated. the calculation is "Ending Depth TVD" * "Interval End MW (lb/gal)" * 0.052 so in interval 1, lets say End Depth TVD is entered in as 10,000, then Interval End MW is entered in as 12.0... the (cell) for interval 1 on Interval TD Hydrostatic Pressure (psi) should show 6,240 How do i get that to run? <!DOCTYPE html> <html> <head> <style> table { font-family: Arial Narrow, Arial Narrow; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 5px; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> <body> <table style="width:100%"> <tr> <th></th> <th>Interval 1</th> <th>Interval 2</th> <th>Interval 3</th> <th>Interval 4</th> <th>Interval 5</th> <th>Interval 6</th> <th>Interval 7</th> </tr> <tr> <td>Ending Depth (TVD)</td> <th><input type="number" id="Interval-1-EndTVD" name="Interval-1-EndTVD" min="0"></th> <th><input type="number" id="Interval-2-EndTVD" name="Interval-2-EndTVD" min="0"></th> <th><input type="number" id="Interval-3-EndTVD" name="Interval-3-EndTVD" min="0"></th> <th><input type="number" id="Interval-4-EndTVD" name="Interval-4-EndTVD" min="0"></th> <th><input type="number" id="Interval-5-EndTVD" name="Interval-5-EndTVD" min="0"></th> <th><input type="number" id="Interval-6-EndTVD" name="Interval-6-EndTVD" min="0"></th> <th><input type="number" id="Interval-7-EndTVD" name="Interval-7-EndTVD" min="0"></th> </tr> <tr> <td>Interval End Mud Weight (lb/gal)</td> <th><input type="number" id="Interval-1-EndMW" name="Interval-1-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-2-EndMW" name="Interval-2-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-3-EndMW" name="Interval-3-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-4-EndMW" name="Interval-4-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-5-EndMW" name="Interval-5-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-6-EndMW" name="Interval-6-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-7-EndMW" name="Interval-7-EndMW" min="0" step="0.01"></th> </tr> <tr> <td>Interval TD Hydrostaic Pressure (psi)</td> <th></th> <th></th> <th></th> <th></th> <th></th> <th></th> <th></th> </tr> </table> </body> </html>
  5. I have a table I've built that is going to have a lot of user input. From the input there are going to be numerous calculations to be found. So I have the table set up, but I don't know how to write the code to get the calculations to work... something like Excel. 1. Row "Interval TD Hydrostatic Pressure (psi) is calculated (in respective column) by: "Ending Depth (TVD)" * "End Mud Weight (lb/gal) * 0.052 2. Row "Interval Footage (ft)" is calculated (in respective column) by: "Ending Depth (MD)" - "Starting Depth (MD)" 3. Row "Expected Hours to Drill" is calculated (in respective column) by: "Interval Footage (ft)" / Expected Avg. ROP (ft/hr) So, what would the JavaScript look like at the bottom of the code in the body? What do I need to put in to calculate the formula upon data entry in between the <th></th> for every combination of row/column? Here's the code: <!DOCTYPE html> <html> <head> <style> table { font-family: Arial Narrow, Arial Narrow; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 5px; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> <body> <table style="width:100%"> <tr> <th></th> <th>Interval 1</th> <th>Interval 2</th> <th>Interval 3</th> <th>Interval 4</th> <th>Interval 5</th> <th>Interval 6</th> <th>Interval 7</th> </tr> <tr> <td>Staring Depth (MD)</td> <th><input type="number" id="Interval-1-StartMD" name="Interval-1-StartMD" min="0"></th> <th><input type="number" id="Interval-2-StartMD" name="Interval-2-StartMD" min="0"></th> <th><input type="number" id="Interval-3-StartMD" name="Interval-3-StartMD" min="0"></th> <th><input type="number" id="Interval-4-StartMD" name="Interval-4-StartMD" min="0"></th> <th><input type="number" id="Interval-5-StartMD" name="Interval-5-StartMD" min="0"></th> <th><input type="number" id="Interval-6-StartMD" name="Interval-6-StartMD" min="0"></th> <th><input type="number" id="Interval-7-StartMD" name="Interval-7-StartMD" min="0"></th> </tr> <tr> <td>Ending Depth (MD)</td> <th><input type="number" id="Interval-1-EndMD" name="Interval-1-EndMD" min="0"></th> <th><input type="number" id="Interval-2-EndMD" name="Interval-2-EndMD" min="0"></th> <th><input type="number" id="Interval-3-EndMD" name="Interval-3-EndMD" min="0"></th> <th><input type="number" id="Interval-4-EndMD" name="Interval-4-EndMD" min="0"></th> <th><input type="number" id="Interval-5-EndMD" name="Interval-5-EndMD" min="0"></th> <th><input type="number" id="Interval-6-EndMD" name="Interval-6-EndMD" min="0"></th> <th><input type="number" id="Interval-7-EndMD" name="Interval-7-EndMD" min="0"></th> </tr> <tr> <td>Ending Depth (TVD)</td> <th><input type="number" id="Interval-1-EndTVD" name="Interval-1-EndTVD" min="0"></th> <th><input type="number" id="Interval-2-EndTVD" name="Interval-2-EndTVD" min="0"></th> <th><input type="number" id="Interval-3-EndTVD" name="Interval-3-EndTVD" min="0"></th> <th><input type="number" id="Interval-4-EndTVD" name="Interval-4-EndTVD" min="0"></th> <th><input type="number" id="Interval-5-EndTVD" name="Interval-5-EndTVD" min="0"></th> <th><input type="number" id="Interval-6-EndTVD" name="Interval-6-EndTVD" min="0"></th> <th><input type="number" id="Interval-7-EndTVD" name="Interval-7-EndTVD" min="0"></th> </tr> <tr> <td>Interval End Mud Weight (lb/gal)</td> <th><input type="number" id="Interval-1-EndMW" name="Interval-1-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-2-EndMW" name="Interval-2-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-3-EndMW" name="Interval-3-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-4-EndMW" name="Interval-4-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-5-EndMW" name="Interval-5-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-6-EndMW" name="Interval-6-EndMW" min="0" step="0.01"></th> <th><input type="number" id="Interval-7-EndMW" name="Interval-7-EndMW" min="0" step="0.01"></th> </tr> <tr> <td>Interval TD Hydrostatic Pressure (psi)</td> </tr> <tr> <td>Interval Footage (ft)</td> </tr> <tr> <td>Expected Avg. ROP (ft/hr)</td> <th><input type="number" id="Interval-1-ROP" name="Interval-1-ROP" min="0"></th> <th><input type="number" id="Interval-2-ROP" name="Interval-2-ROP" min="0"></th> <th><input type="number" id="Interval-3-ROP" name="Interval-3-ROP" min="0"></th> <th><input type="number" id="Interval-4-ROP" name="Interval-4-ROP" min="0"></th> <th><input type="number" id="Interval-5-ROP" name="Interval-5-ROP" min="0"></th> <th><input type="number" id="Interval-6-ROP" name="Interval-6-ROP" min="0"></th> <th><input type="number" id="Interval-7-ROP" name="Interval-7-ROP" min="0"></th> </tr> <tr> <td>Expected Hours to Drill</td> </tr> </table> </body> </html>
  6. so, like this to fix it? I will look into the event. Considering I've got hundreds of calculations to do, is there not a better way to do this? I'm taking a book I wrote in excel and trying to make an actual program out of it. <tr> <td>Interval TD Hydrostaic Pressure (psi)</td> <th> id="Interval-1-Hydrostatic" <script> var a = "Interval-1-EndTVD" var b = "Interval-1-EndMW" var c = 0.052 var z = document.getElementByID(a).value * document.getElementByID(b).value * c; document.getElementById("Interval-1-Hydrostatic").innerHTML = z; </script> </th>
  7. I am a super beginner, never did any of this before. I am trying to get the following two rows to calculate using ID and GetElementByID ... I would like Interval 1 Hydrostatic Pressure to calculate by referring to two other cells within the same column Formula is: Interval 1 Ending Depth TVD * Interval 1 Ending MW * 0.052 Your help is appreciated! <!DOCTYPE html> <html> <head> <style> table { font-family: Arial Narrow, Arial Narrow; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 5px; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> <body> <h1 style="text-align:center; font-family:Arial Narrow; color:#cc7a00; text-shadow: #000 0px 1px 1px; -webkit-font-smooothing: antialiased; font-size:300%; line-height:20px">Test</h1> <h3 style="text-align:center; font-family:Arial Narrow; color:#cc7a00; text-shadow: #000 0px 1px 1px; -webkit-font-smooothing: antialiased; font-size:200%; line-height:20px">Test Calculator</h3> <h2 style="text-align:left; font-family:Arial Narrow; color:#cc7a00; line-height:30px">Customer & Well Info</h2> <form> Customer Name:<br> <input type="text" name="Customer Name"><br> Well Name:<br> <input type="text" name="Well Name"><br> Rig Name:<br> <input type="text" name="Rig Name"><br> Location:<br> <input type="text" name="Location"><br> API #:<br> <input type="text" name="API #"><br> Representative:<br> <input type="text" name="Representative"><br> </form> <p></p> <h2 style="text-align:left; font-family:Arial Narrow; color:#cc7a00; line-height:30px">Interval Analysis</h2> <h3 style="text-align:left; font-family:Arial Narrow; color:#cc7a00; line-height:30px">General Data</h3> <table style="width:100%"> <tr> <th></th> <th>Interval 1</th> <th>Interval 2</th> <th>Interval 3</th> <th>Interval 4</th> <th>Interval 5</th> <th>Interval 6</th> <th>Interval 7</th> </tr> <tr> <td>Section Title (Hole Size)</td> <th><input type="text" name="Interval-1-SectionTitle"></th> <th><input type="text" name="Interval-2-SectionTitle"></th> <th><input type="text" name="Interval-3-SectionTitle"></th> <th><input type="text" name="Interval-4-SectionTitle"></th> <th><input type="text" name="Interval-5-SectionTitle"></th> <th><input type="text" name="Interval-6-SectionTitle"></th> <th><input type="text" name="Interval-7-SectionTitle"></th> </tr> <tr> <td>Fluid System Used</td> <th><input type="text" name="Interval-1-FluidSystem"></th> <th><input type="text" name="Interval-2-FluidSystem"></th> <th><input type="text" name="Interval-3-FluidSystem"></th> <th><input type="text" name="Interval-4-FluidSystem"></th> <th><input type="text" name="Interval-5-FluidSystem"></th> <th><input type="text" name="Interval-6-FluidSystem"></th> <th><input type="text" name="Interval-7-FluidSystem"></th> </tr> <tr> <td>Staring Depth (MD)</td> <th><input type="number" name="Interval-1-StartMD" min="0"></th> <th><input type="number" name="Interval-2-StartMD" min="0"></th> <th><input type="number" name="Interval-3-StartMD" min="0"></th> <th><input type="number" name="Interval-4-StartMD" min="0"></th> <th><input type="number" name="Interval-5-StartMD" min="0"></th> <th><input type="number" name="Interval-6-StartMD" min="0"></th> <th><input type="number" name="Interval-7-StartMD" min="0"></th> </tr> <tr> <td>Ending Depth (MD)</td> <th><input type="number" name="Interval-1-EndMD" min="0"></th> <th><input type="number" name="Interval-2-EndMD" min="0"></th> <th><input type="number" name="Interval-3-EndMD" min="0"></th> <th><input type="number" name="Interval-4-EndMD" min="0"></th> <th><input type="number" name="Interval-5-EndMD" min="0"></th> <th><input type="number" name="Interval-6-EndMD" min="0"></th> <th><input type="number" name="Interval-7-EndMD" min="0"></th> </tr> <tr> <td>Starting Depth (TVD)</td> <th><input type="number" name="Interval-1-StartTVD" min="0"></th> <th><input type="number" name="Interval-2-StartTVD" min="0"></th> <th><input type="number" name="Interval-3-StartTVD" min="0"></th> <th><input type="number" name="Interval-4-StartTVD" min="0"></th> <th><input type="number" name="Interval-5-StartTVD" min="0"></th> <th><input type="number" name="Interval-6-StartTVD" min="0"></th> <th><input type="number" name="Interval-7-StartTVD" min="0"></th> </tr> <tr> <td>Ending Depth (TVD)</td> <th><input type="number" name="Interval-1-EndTVD" min="0"></th> <th><input type="number" name="Interval-2-EndTVD" min="0"></th> <th><input type="number" name="Interval-3-EndTVD" min="0"></th> <th><input type="number" name="Interval-4-EndTVD" min="0"></th> <th><input type="number" name="Interval-5-EndTVD" min="0"></th> <th><input type="number" name="Interval-6-EndTVD" min="0"></th> <th><input type="number" name="Interval-7-EndTVD" min="0"></th> </tr> <tr> <td>Interval Start Mud Weight (lb/gal)</td> <th><input type="number" name="Interval-1-StartMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-2-StartMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-3-StartMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-4-StartMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-5-StartMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-6-StartMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-7-StartMW" min="0" step="0.01"></th> </tr> <tr> <td>Interval End Mud Weight (lb/gal)</td> <th><input type="number" name="Interval-1-EndMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-2-EndMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-3-EndMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-4-EndMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-5-EndMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-6-EndMW" min="0" step="0.01"></th> <th><input type="number" name="Interval-7-EndMW" min="0" step="0.01"></th> </tr> <tr> <td>Interval TD Hydrostaic Pressure (psi)</td> <th> id="Interval-1-Hydrostatic" <script> var a = "Interval-1-EndTVD" var b = "Interval-1-EndMW" var c = 0.052 var z = a * b * c; document.getElementById("Interval-1-Hydrostatic").innerHTML = z; </script> </th> </tr> <tr> <td>Max Inclination (deg)</td> </tr> <tr> <td>Interval Footage (MD)</td> </tr> <tr> <td>Interval Footage (ft)</td> </tr> <tr> <td>Expected Avg. ROP (ft/hr)</td> </tr> <tr> <td>Expected Hours to Drill</td> </tr> <tr> <td>Expected Days to Drill</td> </tr> </table> </body> </html>
×
×
  • Create New...