0 Replies Latest reply on Aug 15, 2013 2:32 PM by Dököll

    Sum two input value with JavaScript within PL/SQL


      Hey Folks!


      Can someone help me remedy the following?  It is rather puzzling:


      I found a pice of JavaScript code I want to use that sums up two input fields, and it works wonders in a Straight HTML form.  But when I attempt the same within PL/SQL, I get a NAN value in return.  Here is the code




          htp.p('<script language="javascript">');

          htp.p('function AddInputs() ');

          htp.p('{ ');

          htp.p('var total = 0;');

          htp.p('var coll = document.getElementsByTagName("input")');

          htp.p('for ( var i = 0; i<coll.length; i++)');

          htp.p('{ ');

          htp.p('    var ele = coll[i];');

          htp.p('    total += parseInt(ele.value);');

          htp.p('} ');

          htp.p(' var Display = document.getElementById("Display");');

          htp.p(' Display.innerHTML = total;');

          htp.p('} ');






         htp.p('<input onkeyup="AddInputs()" />'); 

         htp.p('<input onkeyup="AddInputs()" /> '); 

         htp.p('<input onkeyup="AddInputs()" />'); 

         htp.p('<span id="Display"></span>');




      Here is the original code:






      <script language="javascript">

      function AddInputs()


          var total = 0;

          var coll = document.getElementsByTagName("input")

          for ( var i = 0; i<coll.length; i++)


              var ele = coll[i];

              total += parseInt(ele.value);


          var Display = document.getElementById("Display");

          Display.innerHTML = total;





      <input onkeyup="AddInputs()" />

      <input onkeyup="AddInputs()" />

      <input onkeyup="AddInputs()" />

      <span id="Display"></span>






      thanks for your help!