批改状态:未批改
老师批语:

作业1. 九九乘法表

for(var i=1;i<=9;i++){
for (var j=1;j<=9;j++) {
document.writeln(i + '*' + j + '=' +i*j );
if(i==j){
document.write('<br/>');
break;
}
}
}点击 "运行实例" 按钮查看在线实例
作业2. 打印星号


<script>
var printStars = function (layers) {
let i = 0;
while (i < layers) {
let j = 0;
while (j < i + 1) {
document.writeln(" * ");
j++;
}
document.writeln("<br/>");
i++;
}
}
</script>
<div class="container">
<form class="form-group form-horizontal">
<label class="control-label">请需要星号的层数:</label><input id="inputStars" type="text" class="">
<button type="button" class="btn btn-info btn-sm" onclick="printStars(document.getElementById('inputStars').valu
</form>
</div>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号