我只是想创建一个简单的 javascript 函数来输出一个小表,但似乎无法让它工作。
<html>
<head>
<meta charset ="utf-8">
<title>Test Table</title>
<script type = text/javascript>
function drawTable()
{
var tableDiv = document.getElementById( "numbersTable" );
tableDiv.innerHTML = "<table>" +
"<caption>Numbers Table</caption>" +
"<thead><th>Number</th><th>Square</th><th>Cube</th></thead>" +
"<tbody><tr><td>1</td><td>2</td><td>3</td></tr>" +
"</tbody></table>";
}
</script>
</head>
<body>
<div id = "numbersTable"></div>
</body>
谁能看出问题出在哪里?