www.webdeveloper.com
Results 1 to 2 of 2

Thread: Java Calculator with drop down not working

  1. #1
    Join Date
    Jun 2005
    Posts
    14

    Question Java Calculator with drop down not working

    Here is the script I am using. I haven't done Java in a while. So it might have a basic explanation. I am trying to get the drop down option selected multiplied by the text box value to get a total price.


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <script language="JavaScript1.1" type="text/javascript">

    function startCalc(){
    interval = setInterval("calc()",1);
    }
    function calc(){
    one = document.autoSumForm.firstBox.option.value;
    two = document.autoSumForm.secondBox.value;
    document.autoSumForm.thirdBox.value = (one * 1) * (two * 1);
    }
    function stopCalc(){
    clearInterval(interval);
    }

    </script>
    </head>

    <body>

    <form name="autoSumForm">
    <select name="firstbox" id="height" value="" onFocus="startCalc();" onBlur="stopCalc();">
    <option selected>Select Height</option>
    <option value="32">24&quot; - 26&quot; ($32.00)</option>
    </select> x
    <!-- <input type=text name="firstBox" value="" onFocus="startCalc();" onBlur="stopCalc();"> x -->
    <input type=text name="secondBox" value="" onFocus="startCalc();" onBlur="stopCalc();"> =
    <input type=text name="thirdBox" readonly>
    </form>

    </body>

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Wrong forum. Ask in the JavaScript forum.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles