Use do-while loop and prompt dialog to read user input : Do While « Statement « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
do
{
    sometext = prompt("Enter some text","");
}
while (sometext == "");
alert(sometext);
//  -->
</script>
</head>
<body>

</body>
</html>








3.7.Do While
3.7.1.do...while
3.7.2.Do While loop
3.7.3.Use do-while loop and prompt dialog to read user input
3.7.4.Use or (||) in do-while condition
3.7.5.Use integer variable to control a do-while loop