do...while

種類命令
書式
do {
処理
}while(条件)
解説
条件を満たしている間ブロック内を繰り返します。条件判断は最後にチェックするため、最低でも1回繰り返し処理が行われます。
サンプルコード
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<style type="text/css"><!--
body { margin:0px; }
form { position:absolute; top:10;left:10px; }
--></style>
<script type="text/javascript"><!--
window.onload = function()
{
n = 0;
do {
n++;
document.getElementById("txtField").value = n;
}while (n<3);
}
// --></script>
</head>
<body>
<img src="Default.png">
<form>
<input type="text" id="txtField" size=40"><br>
</form>
</body>
</html>
実際のスクリプトをダウンロード