一.等腰三角形
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
function show(row){
for (var i = 1; i < row; i++) {
for(var j=1;j<row-i;j++){
document.write(' ');
}
for(var k=1;k<=2*i-1;k++){
document.write('*');
}document.write('<br>');
}
}
show(7);
</script>
</body>
</html>
二.菱形
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
function show(row){
for (var i = 1; i < row; i++) {
for(var j=1;j<row-i;j++){
document.write(' ');
}
for(var k=1;k<=2*i-1;k++){
document.write('*');
}document.write('<br>');
}
for(var s=2;s<row;s++){
for(var a=1;a<s;a++){
document.write(' ');
}
for(var b=1;b<=(row-a)*2-1;b++){
document.write('*');
}document.write('<br>');
}
}
show(7);
</script>
</body>
</html>
三.九九乘法表
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
function show(num){
for(var i=1;i<num;i++){
for(var a=1;a<=i;a++){
var b=a*i;
if (b<10) {
b=' '+b
}
document.write(a+'x'+i+'='+b+" ")
}document.write('<br>');
}
}show(10);
</script>
</body>
</html>