1. Membuat belah ketupat pada HTML dengan JavaScript
berikut script-nya :
berikut script-nya :
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="endar" />
<title>endar belah ketupat</title>
<script type="text/javascript">
var i,j,y;
for(i=10;i>0;i--){
for(j=1;j<=i-1;j++){
document.write("   ");
}
for(y=1;y<=10-i+1;y++){
document.write(" * ");
}
for(l=1;l<=10-i;l++){
document.write(" * ");
}
document.write("<br>");
}
for(i=1;i<=10;i++){
for(j=1;j<=i;j++){
document.write("   ");
}
for(y=1;y<=10-i;y++){
document.write(" * ");
}
for(l=1;l<10-i;l++){
document.write(" * ");
}
document.write(" <br> ");
}
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="endar" />
<title>endar belah ketupat</title>
<script type="text/javascript">
var i,j,y;
for(i=10;i>0;i--){
for(j=1;j<=i-1;j++){
document.write("   ");
}
for(y=1;y<=10-i+1;y++){
document.write(" * ");
}
for(l=1;l<=10-i;l++){
document.write(" * ");
}
document.write("<br>");
}
for(i=1;i<=10;i++){
for(j=1;j<=i;j++){
document.write("   ");
}
for(y=1;y<=10-i;y++){
document.write(" * ");
}
for(l=1;l<10-i;l++){
document.write(" * ");
}
document.write(" <br> ");
}
</script>
</head>
<body>
</body>
</html>
Tidak ada komentar:
Posting Komentar