べき乗を求めるには

<html>
<head>
<title>Sample</title>
<script type="text/javascript"><!--
function power(fObj)
{
n = fObj.num.value;
num = Math.pow(2,n);
fObj.result.value = num;
}
// --></script>
</head>
<body>
べき乗を求めます。<br><br>
<form>
 値:<input type="text" value="2" name="num"><br>
結果:<input type="text" name="result"><br>
<input type="button" value="べき乗を求める" onClick="power(this.form)">
</form>
</body>
</html>
・サンプルを実行
・サンプルをダウンロード
逆引きクイックリファレンス JavaScript 説明などは本書を参考にしてください。