[nfbcs] trying to make a smart page

Aaron Cannon cannona at fireantproductions.com
Thu Jan 15 17:01:02 UTC 2015


This appears to be working just fine for me.  I'm testing in Firefox.

Remember that if you are opening a local file, rather than loading the
JS from a web site, that you may need to tweak some security settings
in your browser, in order for it to run the JS.

You can try this bin:
http://jsbin.com/tuqehilovo/1

That's the preview.

To edit it, see http://jsbin.com/tuqehilovo/1/edit?html,js

Aaron

On 1/15/15, Stanzel, Susan - FSA, Kansas City, MO via nfbcs
<nfbcs at nfbnet.org> wrote:
> Good morning Listers,
>
> I am sending this to both lists. I have been asked to try to get this
> working. They want to add numbers together keeping track of the running
> total. I am using Windows7, IE9, and JAWS 15. Any assistance will be greatly
> appreciated. It works better in FireFox, but our default browser is IE. I
> know how to read HTML and JavaScript, but I am not very knowledgible on
> writing it. The code follows my name.
>
> Susie
>
> <!DOCTYPE  html>
> <html>
>        <head>
>               <title>Output test</title>
>        </head>
>        <body>
>               <form method="post" action="#">
>                      <label for="input1Id">Input 1:</label>
>                      <input id="input1Id" aria-controls="outputId"
> type="text">
>                      <br>
>                      <label for="input2Id">Input 2:</label>
>                      <input id="input2Id" type="text"
> aria-controls="outputId" >
>                      <br>
>                      <label for="input3Id">Input 3:</label>
>                      <input id="input3Id" type="text"
> aria-controls="outputId">
>                      <hr>
>                      <div aria-live="polite" aria-atomic="true"
> role="region"
> aria-labelledby="Result">
>
>                      <span id="sumLabel">Sum: </span>
>                      <span id="outputId" >
>                      </span>
>                      </div>
>               </form>
>               <script type="text/javascript">
>                      var inputIds = ["input1Id", "input2Id", "input3Id"];
>                      function handleBlur()
>                      {
>                            var output =
> document.getElementById("outputId");
>                            var sum = 0;
>                            for (var i = 0; i < inputIds.length; i++)
>                            {
>                                   var inputId = inputIds[i];
>                                   var input =
> document.getElementById(inputId);
>                                   var value = parseInt(input.value, 10);
>                                   if (! isNaN(value))
>                                   {
>                                          sum += value;
>                                   }
>                            }
>                            output.removeChild(output.firstChild);
>                            var text = document.createTextNode(sum);
>                            output.appendChild(text);
>                      }
>
>
>
>                      var inputs = document.getElementsByTagName("input");
>                      for (var i = 0; i < inputs.length; i++)
>                      {
>                            inputs[i].addEventListener("blur", handleBlur);
>
>                      }
>                      document.getElementById("input1Id").focus();
>               </script>
> </html
>
>
>
>
> This electronic message contains information generated by the USDA solely
> for the intended recipients. Any unauthorized interception of this message
> or the use or disclosure of the information it contains may violate the law
> and subject the violator to civil or criminal penalties. If you believe you
> have received this message in error, please notify the sender and delete the
> email immediately.
> _______________________________________________
> nfbcs mailing list
> nfbcs at nfbnet.org
> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
> To unsubscribe, change your list options or get your account info for
> nfbcs:
> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/cannona%40fireantproductions.com
>




More information about the NFBCS mailing list