Use div to store result.
This commit is contained in:
		| @@ -9,20 +9,21 @@ | |||||||
| 				var notaLMSGI = parseInt(document.getElementById("notaLMSGI").value); | 				var notaLMSGI = parseInt(document.getElementById("notaLMSGI").value); | ||||||
| 				var notaGBD = parseInt(document.getElementById("notaGBD").value); | 				var notaGBD = parseInt(document.getElementById("notaGBD").value); | ||||||
| 				var avg = (notaISO + notaLMSGI + notaGBD)/3; | 				var avg = (notaISO + notaLMSGI + notaGBD)/3; | ||||||
| 				alert("La nota media es " + avg); | 				document.getElementById("result").innerHTML = "<p>Resultado: " + avg + "</p>"; | ||||||
| 			} | 			} | ||||||
| 		</script> | 		</script> | ||||||
| 	</head> | 	</head> | ||||||
| 	<body> | 	<body> | ||||||
| 		<h1>Calculadora Promedio Notas</h1> | 		<h1>Calculadora Promedio Notas</h1> | ||||||
| 		<form> | 		<form onsubmit="event.preventDefault(); average()" > | ||||||
| 			<label>ISO:</label><br /> | 			<label>ISO:</label><br /> | ||||||
| 			<input type="number" id="notaISO" name="notaISO" min="0" max="10" value="0" ><br /> | 			<input type="number" id="notaISO" name="notaISO" min="0" max="10" value="0" ><br /> | ||||||
| 			<label>LMSGI:</label><br /> | 			<label>LMSGI:</label><br /> | ||||||
| 			<input type="number" id="notaLMSGI" name="notaLMSGI" min="0" max="10" value="0" ><br /> | 			<input type="number" id="notaLMSGI" name="notaLMSGI" min="0" max="10" value="0" ><br /> | ||||||
| 			<label>GBD:</label><br /> | 			<label>GBD:</label><br /> | ||||||
| 			<input type="number" id="notaGBD" name="notaGBD" min="0" max="10" value="0" ><br /> | 			<input type="number" id="notaGBD" name="notaGBD" min="0" max="10" value="0" ><br /> | ||||||
| 			<button onclick="average()" >Calcular</button> | 			<input type="submit" > | ||||||
| 		</form> | 		</form> | ||||||
|  | 		<div id="result" ></div> | ||||||
| 	</body> | 	</body> | ||||||
| </html> | </html> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user