当前位置:网站首页>使用JS在浏览器中打印菱形
使用JS在浏览器中打印菱形
2022-08-04 05:31:00 【look up at the stars】
打印菱形:(当页面加载完毕时根据弹出的提示信息输入想要打印的菱形的行数。注释:输入的数字为菱形的行数一半+1)
例如下图即输入6以后打印的图形。
示例代码:
<script type="text/javascript">
var num=prompt("请输入打印的行数:","");
for (var i=1;i<=num;i++){
document.write(" ");
for (var k=num;k>=i;k--){
document.writeln(" ");
}
for (var j=1;j<=2*i-1;j++){
if(j%2==0){
document.writeln(" ");
}else{
document.writeln("*");
}
}
document.write("<br/>");
}
for (var i=num-1;i>=1;i--){
document.write(" ");
for (var k=num;k>=i;k--){
document.writeln(" ");
}
for (var j=1;j<=2*i-1;j++){
if(j%2==0){
document.writeln(" ");
}else{
document.writeln("*");
}
}
document.write("<br/>");
}
</script>
边栏推荐
- target has libraries with conflicting names: libcrypto.a and libssl.a.
- Fabric v1.1 环境搭建
- (Navigation page) OpenStack-M version - manual construction of two nodes - with video from station B
- MNIST手写数字识别 —— ResNet-经典卷积神经网络
- [开发杂项][调试]debug into kernel
- arm-2-基础阶段
- [开发杂项][编辑器][代码阅读]ctags&vim
- MNIST Handwritten Digit Recognition - From Perceptrons to Convolutional Neural Networks
- MNIST手写数字识别 —— 图像分析法实现二分类
- 详解近端策略优化
猜你喜欢

LeetCode_Dec_3rd_Week

MNIST手写数字识别 —— 图像分析法实现二分类

语音驱动嘴型与面部动画生成的现状和趋势

剪映专业版字幕导出随笔

arm交叉编译

The second official example analysis of the MOOSE platform - about creating a Kernel and solving the convection-diffusion equation

MNIST手写数字识别 —— ResNet-经典卷积神经网络

MNIST手写数字识别 —— Lenet-5首个商用级别卷积神经网络

AWS使用EC2降低DeepRacer的训练成本:DeepRacer-for-cloud的实践操作

Golang环境变量设置(二)--GOMODULE&GOPROXY
随机推荐
动态内存管理-C语言
MNIST手写数字识别 —— Lenet-5首个商用级别卷积神经网络
[English learning][sentence] good sentence
"A minute" Copy siege lion log 】 【 run MindSpore LeNet model
剪映专业版字幕导出随笔
深度学习,“粮草”先行--浅谈数据集获取之道
Introduction to Convolutional Neural Networks
Deep Learning Theory - Overfitting, Underfitting, Regularization, Optimizers
Install Minikube Cluster in AWS-EC2
LeetCode_Nov_1st_Week
亚马逊云科技Build On-Amazon Neptune基于知识图谱的推荐模型构建心得
打金?工作室?账号被封?游戏灰黑产离我们有多近
makefile基础学习
LeetCode_22_Apr_2nd_Week
LeetCode_Dec_3rd_Week
Chapter One Introduction
卷积神经网络入门详解
How to grow into a senior engineer?
MNIST handwritten digit recognition - based on Mindspore to quickly build a perceptron to achieve ten categories
No matching function for call to ‘RCTBridgeModuleNameForClass‘