Web Analytics Made Easy -
StatCounter Would someone be so kind to look over this LITTLE program for me? - CodingForum


No announcement yet.

Would someone be so kind to look over this LITTLE program for me?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Would someone be so kind to look over this LITTLE program for me?

    I know I"m doing something wrong here because nothing will load on the screen. I'm a complete dumbass when it comes to javascript. I can only understand SIMPLE things and this has proved to be way too advanced for me.

    Basically, I can't get my program to allow users to input both the number and i (which is the power of i). Being unable to do that, I can't get it to output anything either. Thank you in advance!


    <script type="text/javascript">
    var num, i;

    num = myform.element [0].value;
    i = myform.element [0].value;

    function argument(num, i)
    if( i == 0)
    return 1;

    var result;
    result = Math.pow(num,i);

    return result;

    document.write (result);

    Last edited by anythursday; Jul 28, 2005, 09:34 PM.

  • #2
    People are not going to do your HWK here for you... they will have informative posts though. Just an FYI.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.


    • #3
      For starters this doesn't belong in Computer Programming. This is javascript and we have a forum for that. I'm sure this thread will be moved there in due time.

      And as was mentioned we will not do homework assignments but we will answer specific questions and guide you in the right direction.

      You said you need to get input from the user. In your script you are trying to retrieve a value from a form but I do not see any code for a form in your page. You would need to put a form in there.
      CodingForum Supreme Overlord
      All Hail Spookster