If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Member EdMarks's Avatar
    Join Date
    Nov 2011
    181 lat 91 long
    Member #
    3 times
    I am trying to make my first app using phonegap.
    However this question is not phonegap related.

    I have a basic calculator that I wanted to add some extra functions for a friend who is in sales.

    I wanted him to be able to type in the total of his order.
    Hit the "total" button.
    The total would then be held in a variable and be displayed in the "total" box on the bottom left.
    The screen would clear.
    The user would then type in his cost on the product hit total again and the calculator would
    then find out his commission and the subtotal.

    However as soon as I hit "total" the number is displayed in the "total" box on the bottom left
    for only a split second before "reloading" and wiping the text from the total box

    Does anyone know why this is happening and how I can get the text to stay there until the user refreshes the page or hits clear.

    I notice when I use the calculator the numbers stay there. So am I improperly using functions?

    Any help would be greatly appreciated.

    I have hosted the page at

    and here is the code
            <script type="text/javascript" language="javascript">
            var isCodBool = 0;
            var isFrontBool = 0;
            var shippingIsVar = 0;
            var shippingValue = 0;
            function submitShipping()
                var radios = document.getElementsByName('shipping');
                for(var i=0, length = radios.length; i < length; i++)
                    if (radios[i].checked){
                    return radios[i].value;
            function isCod()
            isCodBool = 1;    
            function isFront()
            isFrontBool = 1;    
            function comissionIs()
            function totalValue()
                var tempTotal = 0;
                var tempTwo = 2;
                var tempShipping = 0;
                tempShipping = submitShipping();
                tempShipping = parseInt(tempShipping);
                tempTotal = document.getElementById("textboxin").value;
                tempTotal = parseInt(tempTotal);
                tempTotal += 6;
                document.getElementById("outputTotal").value = tempTotal;
                document.getElementById("shippingOutput").value = tempShipping;


  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Not from USA
    Member #
    2784 times
    Because "total" is a submit button.

    Add this line to the end of your totalvalue function:

    return false;
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 01:24 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: