简单的for循环练习,老司机请绕行。
知识点:for循环
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>99乘法表</title>
<style>
* { padding: 0; margin: 0; }
html { width: 100%; height: 100%; background: #242424; font-family: 'Arial'; }
body { width: 100%; height: 100%; }
#m_table { color: #fff; font-size: 20px; }
</style>
</head>
<body>
<div id="m_table"></div>
<script>
var m_table = document.getElementById('m_table');
var html = '';
for (var i = 1; i <= 9; i++) {
for (var j = 1; j <= i; j++) {
html += j + " x " + i + " = " + j * i + " ";
}
html += "</br>";
}
m_table.innerHTML = html;
</script>
</body>
</html>