PDA

View Full Version : Would someone be so kind to look over this LITTLE program for me?


anythursday
07-29-2005, 03:27 AM
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!

<html>
<body>

<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);
</script>

</body>
</html>

SpirtOfGrandeur
07-29-2005, 03:40 AM
People are not going to do your HWK here for you... they will have informative posts though. Just an FYI.

Spookster
07-29-2005, 07:19 AM
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.