66 lines
1.9 KiB
HTML
66 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Women4IT - JavaScript</title>
|
|
<meta name="description" content="Women4IT JavaScript Exercise: Variables -1">
|
|
<!-- Bootstrap CSS -->
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
|
<!-- Customise Bootstrap for practical grid layouts -->
|
|
<link rel="stylesheet" href="../assets/css/bootstrap-custom.css">
|
|
<style>
|
|
.container { padding-top: 40px }
|
|
.js-box {
|
|
border:solid 1px yellow;
|
|
padding:20px;
|
|
background-color: lightyellow;
|
|
margin-bottom: 48px;
|
|
font-size: larger;
|
|
}
|
|
#resultBox, #resultNum {
|
|
border: solid 1px green;
|
|
height: 40px;
|
|
background-color: #E7FFE7;
|
|
width: 280px;
|
|
padding: 3px 12px;
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
<div class="container col-md-8 offset-md-2">
|
|
<h1><b>Exercise 8-3</b>: JavaScript Loops</h1>
|
|
<p>This script provides an example of a <i>while</i> loop.</p>
|
|
|
|
<h3>Creating a simple <i>while</i> loop</h3>
|
|
<div class="js-box">
|
|
|
|
<script>
|
|
let i = 10;
|
|
while (i >= 1)
|
|
{
|
|
document.write("This is loop step number: <b>"+i+"<\/b>.<br>")
|
|
i--;
|
|
}
|
|
</script>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- jQuery library -->
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
<!-- Popper JS -->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
|
|
<!-- Latest compiled JavaScript -->
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
|
</body>
|
|
</html> |