Prezi

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in the manual

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Ejemplo para sacar promedio de notas con JavaScript

No description
by L M on 10 April 2011

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Ejemplo para sacar promedio de notas con JavaScript

Ejemplo JavaScript





Calcular
Promedio Les comparto este ejemplo para calcular el promedio de calificaciones con JavaScript <body>
<H1>CALCULAR PROMEDIO</H1>
<form name="form1" method="post" action="">
Nota 1 <input type="text" name="nota1">
<br>
Nota 2 <input type="text" name="nota2">
<br>
Nota 3 <input type="text" name="nota3">
<br>
Nota 4 <input type="text" name="nota4">
<br>
Promedio <INPUT name="informe" type="text">
<br>
<input type="button" name="Submit" value="calcular" onclick="promedio()">
<input type="reset" name="Submit2" value="Restablecer">
</form>
</body>
</html> Con este código puedes calcular el promedio para cuatro notas Lo puedes aplicar en el ejercicio de la semana 4 Cualquier duda que tengas escribes al foro de dudas e inquietudes Mucho ánimo <html>
<head>
<title>promedio</title>

<script>
function promedio(){
sum=0;
tot=0;
for(i=0;i<document.form1.elements.length;i++){
ele=document.form1.elements[i];
if(ele.type=='text' && !isNaN(parseInt(ele.value))){

sum+=1;
tot+=parseInt(ele.value);
}
}
if(sum!=0){
prom=tot/sum;document.form1.informe.value=prom;
}else{
document.form1.informe.value=0;
}
}
</script>
</head> Quedaría así:
See the full transcript