locked
add extra value in javascript RRS feed

  • Question

  • User-807418713 posted

    Hello

    This is my code

    <script type="text/javascript">
    function onmouseover_Item()
    {
    
     
     
        var AvailablePcs = parseFloat(document.getElementById('TAvi').value);
        var TotalPcs = parseFloat(document.getElementById('TPcs').innerText);
    
       
    
        if (AvailablePcs < TotalPcs)
            {
                alert('Please Check The Total Value');
                return false;
            }
       
        return true
    }
    </script>

    I want to add pone more value that is AvailblePcs < TotalPcs + ExtraPcs That ExtraPcs Value Will Be 10

    Friday, February 1, 2019 7:20 AM

Answers

  • User-943250815 posted

    From what I understand you can it like

    <script type="text/javascript">
    function onmouseover_Item()
    { 
        var AvailablePcs = parseFloat(document.getElementById('TAvi').value);
        var TotalPcs = parseFloat(document.getElementById('TPcs').innerText);
        var ExtraPcs = 10;
       
    
        if (AvailablePcs < (TotalPcs + ExtraPCs))
            {
                alert('Please Check The Total Value');
                return false;
            }
       
        return true
    }
    </script>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 1, 2019 3:21 PM

All replies

  • User-943250815 posted

    From what I understand you can it like

    <script type="text/javascript">
    function onmouseover_Item()
    { 
        var AvailablePcs = parseFloat(document.getElementById('TAvi').value);
        var TotalPcs = parseFloat(document.getElementById('TPcs').innerText);
        var ExtraPcs = 10;
       
    
        if (AvailablePcs < (TotalPcs + ExtraPCs))
            {
                alert('Please Check The Total Value');
                return false;
            }
       
        return true
    }
    </script>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 1, 2019 3:21 PM
  • User839733648 posted

    Hi Gopi.MCA,

    According to your description, I'm confused about where is the ExtraPcs value from.

    Is it from an input field or just a static value?

    Best Regards,

    Jenifer

    Monday, February 4, 2019 7:23 AM