Jump to content

Subtractiong Values


Flamengo

Recommended Posts

Hi,

Im trying to subtract 3 from the value If the radio button is checked. However, its not working.

<script type="text/javascript">
        function calcShipping()
        {
            
            var txtWeight, pound1, pound2, pound3, freq, notfreq, freq1;
            
            var values = " ";
            freq1 = 3;
            pound1 = 5;
            pound2 = 10;
            pound3 = 15;
            txWeight = document.getElementById("txtWeight").value;
            txWeight=parseInt(txWeight);
            
            if (txWeight < 1)
                {document.write("Your cost is " + pound1 + "$.") };
            if (txWeight >= 1 & txWeight < 3)
                {document.write("Your cost is " + pound2 + "$.") };
            if (txWeight >= 3 & txWeight <= 5)
                {document.write("Your cost is " + pound3 + "$.") };
            
            if (document.getElementById("freq").checked = true){
                document.write(" Your cost is " + (txtWeight.result - freq1) + "$.");
            }
            else if (document.getElementById("notfreq").checked){
                document.write("Your cost is " + (txtWeight.value) + "$.");
            }
               
            
                
            
        }
    
                    
    </script>

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
×
×
  • Create New...