Combine do-while loop and prompt dialog to read user input : do while « Language Basics « JavaScript DHTML






Combine do-while loop and prompt dialog to read user input

 


<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>

   
  








Related examples in the same category

1.Use do-while loop and prompt dialog to restrict user input