JS之for循环实现(倒)九九乘法表
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>九九乘法表</title>
<link rel="stylesheet" href="">
<script>
document.write('<table border="1" ccellpadding="0" ccellpadding="0" bgcolor="#ABCDEF" width="80%">');
for(var i=1;i<=9;++i){
document.write('<tr>');
for(var j=1;j<=i;j++){
document.write('<td>'+i+'x'+j+'='+(i*j)+'</td>');
}
document.write('</tr>');
}
document.write('</table>');
</script>
</head>
<body>
</body>
</html>
倒九九乘法表
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>1-100之间的奇数和</title>
<link rel="stylesheet" href="">
<script>
document.write('<table border="1" ccellpadding="0" ccellpadding="0" bgcolor="#ABCDEF" width="80%">');
for(var i=9;i>=1;i--){
document.write('<tr>');
for(var j=1;j<=i;j++){
document.write('<td>'+i+'x'+j+'='+(i*j)+'</td>');
}
document.write('</tr>');
}
document.write('</table>');
</script>
</head>
<body>
</body>
</html>
标签:JavaScript