Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get number from input

var Malfunctions = parseInt(document.getElementById("Malfunctions").value);
Comment

html input get number



<form id="frm1" action="Calculate.html">
    <table width="350px" border="1px">
        <tr>
            <th colspan="2">Availability</th>
        </tr>
        <tr>
            <td>Total Production Time</td>
            <td>
                <input type="number" id="TotalProductionTime" placeholder="">hours</td>
        </tr>
        <tr>
            <td>Breaks</td>
            <td>
                <input type="number" id="Breaks" placeholder="">minutes</td>
        </tr>
        <tr>
            <td>Malfunctions</td>
            <td>
                <input type="number" id="Malfunctions" placeholder="">minutes</td>
        </tr>
        <tr>
            <td>Theoretical production time:</td>
            <td>
                <p id="test"></p>
            </td>
        </tr>
    </table>
    <input type="button" onclick="Calculate()" value="calculate">
</form>


function Calculate() {
    var TotalProductionTime = document.getElementById("TotalProductionTime").value;
    var TotalProductionTimeInMinutes = TotalProductionTime * 60;
    var Breaks = document.getElementById("Breaks").value;
    var Malfunctions = document.getElementById("Malfunctions").value;
    var TheoreticalProductionTime = TotalProductionTimeInMinutes - Breaks - Malfunctions;

    document.getElementById("test").innerHTML = TheoreticalProductionTime;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery check if checkbox is not checked 
Javascript :: how to find out if mongoose is connected or not 
Javascript :: default ordering false in datatable 
Javascript :: create an array of numbers by numbers range in angular 
Javascript :: detect browser theme 
Javascript :: font weight react native 
Javascript :: js check file exist 
Javascript :: select onchange pass option value in angular 6 
Javascript :: javascript remove last character from string 
Javascript :: how to click button programmatically in jquery 
Javascript :: node read csv 
Javascript :: change placeholder text jquery 
Javascript :: how to add print button on my website 
Javascript :: nuxt 18 mountend route push 
Javascript :: loop json 
Javascript :: angular form set value without fire event 
Javascript :: javascript check empty object 
Javascript :: javascript sleep 1 second 
Javascript :: javascript loop through string 
Javascript :: javascript loop through all element children 
Javascript :: npm ERR! errno ECONNRESET 
Javascript :: fetch then then return value 
Javascript :: javascript friendly number format with commas 
Javascript :: js remove undefined from object 
Javascript :: js map iterate 
Javascript :: javascript modify url without reload 
Javascript :: js replace space with plus 
Javascript :: how to call a javascript function in html without any event 
Javascript :: css font size jsx 
Javascript :: react open a link to an outside siite 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =