javascripthtmldom

JavaScript webpage


I am having trouble debugging my JavaScript webpage. Where I am having difficulty is where I marked (...). I get errors of undefined. Do I place my parameters from my function countDown(start, increment) which are start and increment into (...)?

<dl>
startNum:&nbsp;&nbsp;<input type="text" id="<!-- (...) -->"/>
countBy:&nbsp;&nbsp;<input type="text" id="<!-- (...) -->"/>
<br/>
<input type="button" value="Run Function" onClick="onClickFunc5()" />
<script>
   function onClickFunc5()
   {
      var startNum = document.getElementById('<!-- (...) -->').value;
      var countBy = document.getElementById('<!-- (...) -->').value;

      <!-- countDown(start, increment) -->
      <!-- (...) -->
   }
</script>

Solution

  • I would try this:

    startNum:&nbsp;&nbsp;<input type="text" id="startInput"/>
    countBy:&nbsp;&nbsp;<input type="text" id="countByInput"/>
    <br/>
    <input type="button" value="Run Function" onClick="onClickFunc5()" />
    <script>
       function onClickFunc5()
       {
          var startNum = document.getElementById('startInput').value;
          var countBy = document.getElementById('countByInput').value;
    
          <!-- countDown(startNum, countBy) -->
          <!-- (...) -->
       }
    </script>
    

    Did you create the countDown function yourself or is it part of a plugin that you want to use? You may not be including the plugin that you need.

    Also, you never closed the dl tag