Add exercise LMSGI/PromedioNotas

This commit is contained in:
Nicolás A. Ortega Froysa 2022-04-26 20:05:23 +02:00
parent 161dae282e
commit 5c76e808f0
3 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,37 @@
<html>
<head>
</head>
<body>
<h1>Notas</h1>
<script type="text/javascript">
var nota1,nota2,nota3;
nota1=prompt('Ingrese 1ra. nota:','');
nota2=prompt('Ingrese 2da. nota:','');
nota3=prompt('Ingrese 3ra. nota:','');
//Convertimos los 3 string en enteros
nota1=parseInt(nota1);
nota2=parseInt(nota2);
nota3=parseInt(nota3);
var pro;
pro=(nota1+nota2+nota3)/3;
if (pro>=7)
{
document.write('promocionado');
}
else
{
if (pro>=4)
{
document.write('regular');
}
else
{
document.write('reprobado');
}
}</script>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/
xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ejemplo de código JavaScript en el propio documento</title>
<script type="text/javascript">
/**function limita(maximoCaracteres) {
var elemento = document.getElementById("texto");
if(elemento.value.length >= maximoCaracteres ) {
return false;
}
else {
return true;
}
}
**/
function comprueba(){
var cuadrotxt = document.getElementById("elemento");
alert ("value; "+cuadrotxt.value+"\n type: "+cuadrotxt.type+"\n name: "+cuadrotxt.name);
alert ("elemento2: "+cuadrotxt.form.elemento2.value);
}
window.onload=function(){
if(document.forms.length > 0) {
if(document.forms[0].elements.length > 0) {
document.forms[0].elements[0].focus();
}
}
}
</script>
</head>
<body>
<form name="formulario" id="formulario" >
<input type="number" name="elemento" id="elemento" />
<input type="number" name="elemento2" id="elemento2" />
<textarea id="texto" onkeypress="return limita(100);"></textarea>
<input type="button" value="Enviar" onclick="this.value='enviando...';comprueba()"/>
</form>
</body>
</html>
<!--this.disabled=true;-->

View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Promedio de Notas</title>
<script type="text/javascript">
function average() {
var notaISO = parseInt(document.getElementById("notaISO").value);
var notaLMSGI = parseInt(document.getElementById("notaLMSGI").value);
var notaGBD = parseInt(document.getElementById("notaGBD").value);
var avg = (notaISO + notaLMSGI + notaGBD)/3;
alert("La nota media es " + avg);
}
</script>
</head>
<body>
<h1>Calculadora Promedio Notas</h1>
<form>
<label>ISO:</label><br />
<input type="number" id="notaISO" name="notaISO" min="0" max="10" value="0" ><br />
<label>LMSGI:</label><br />
<input type="number" id="notaLMSGI" name="notaLMSGI" min="0" max="10" value="0" ><br />
<label>GBD:</label><br />
<input type="number" id="notaGBD" name="notaGBD" min="0" max="10" value="0" ><br />
<button onclick="average()" >Calcular</button>
</form>
</body>
</html>