<head>
<script>
function whammo()
{
var i = 1;
while(i<=5)
{
document.write("<h6>Test</h6>");
i=i+1;
}
}
</script>
</head>
<body>
<div id='page'></div>
<script>
document.getElementById('page').innerHTML = whammo();
</script>
</body>
whammo函数是返回5个要显示的h6 Tests,但是它返回如下: undefined Test Test Test Test Test
我在这里做了测试: http ://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_elmnt_innerhtml
为什么返回未定义?