Jump to content
  • Advertisement
Sign in to follow this  

can someone help me debug this program??

This topic is 3592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

<html> <head><title>Final Exam Debug</title> <script type="text/javascript"> function Calculate(f){ var sum, ctr; for(ctr=0, ctr<=4, ctr++){ sum = elementsArray[ctr].value; } //end of for loop f.sumBox.value = sum; f.averageBox.value = sum/4; } //end of function </script> </head> <body> Please enter four numbers in the boxes below: <br/> <form id="numbersForm" name="numbersForm"> <input type="text" name="num1Box" size="5"/><br/> <input type="text" name="num2Box" size="5"/><br/> <input type="text" name="num3Box" size="5"/><br/> <input type="text" name="num4Box" size="5"/>

<input type="button" value="Calculate Sum and Average" onclick="calculate(document)">

The sum is: <input type="text" name="sumBox" size="6"/><br/> The average is: <input type="text" name="averageBox" size="6"/><br/> </form> </body> </html>

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!