Difference between revisions of "JavaScript: Exemplo de uso do while"

From AdonaiMedrado.Pro.Br
Jump to: navigation, search
(New page: <code lang="html"> <html> <head> <title>Minha Página</title> </head> <body> <script> var i = 0; while(i<10) { document.write("<input type=\"text\" id=\"txtTeste" + i + "\""...)
 
 
Line 1: Line 1:
<code lang="html">
+
<code lang="javascript">
 
<html>
 
<html>
 
<head>
 
<head>

Latest revision as of 22:32, 12 September 2008

<html>
	<head>
		<title>Minha Página</title>
	</head>
	<body>
	<script>
		var i = 0;
		while(i<10)
		{
			document.write("<input type=\"text\" id=\"txtTeste" + i + "\"" + ">");
			document.write("<input type=\"button\" id=\"btOK" + i + "\"" + " value=\"OK\">");
			document.write("<br />");
			msg = prompt("Digite seu texto.","Seu texto");
			document.getElementById("txtTeste" + i).value = msg;
			i++;
		}
	</script>
	</body>
</html>