1から5まで数値を表示する。


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>処理を繰り返したい(while)</title>
</head>
<body>
<p>1から5まで数値を表示する。</p>
<script type="text/javascript">
<!--
i = 1;
while(i <= 5){
document.write("i = " , i , "<br>");
i++;
}
//-->
</script>
</body>
</html>