JavaScript - Enlazar mi archivo HTML con Java Script

 
Vista:

Enlazar mi archivo HTML con Java Script

Publicado por Walter (2 intervenciones) el 20/02/2020 17:43:15
Tengo un requerimiento, estoy haciendo un ejercicio en el cual me piden que haga un formulario pdiiendo los siguientes parametros de un estudiante: nombre, apellido, telefono, direccion, cedula y correo electronico. tambien me piden que en Java Script saque el total a pagar de un estudiante, con 3 condiciones:
1. si el estudiante reprueba una materia, se le aumentara el 10% del costo del semestre
2. si el estudiante reprueba dos materias, se aumentara el 20%
3. Y si reprueba 3 materias no podra inscribirse

aqui dejo mi codigo html para que puedan ayudarme:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
  <head>
    <title>Inscripcion del Estudiante</title>
  </head>
  <body background= "e11.jpg">
    <form name ="registro">
    <center><h1> Inscribete en nuestra Universidad </h1></center>
    <p><center>Queremos probar contigo nuestro nuevo sistema de inscripcion mediante este sencillo formulario que tienes que llenar </center</p>
    <table border="2px">
    <tr>
     <br><center><td><strong> Nombre del Estudiante</strong></td></center><br>
     <center><td> <input type="text" name ="nombre" id = "nombre"></td> </center>
    </tr>
    <tr>
      <br><center><td><strong> Apellido del Estudiante</strong> </td></center><br>
      <center><td> <input type="text" name = "apellido" id= "apellido"></td> </center>
    </tr>
    <tr>
    <center><td><strong> Numero de Telefono del Estudiante</strong>  </td></center>
    <center><td> <input type="text" name = "telefono" id = "telefono"></td> </center>
    </tr>
    <tr>
    <center><td><strong> Direccion del Estudiante</strong>  </td></center>
    <center><td> <input type="text" name = "direccion" id = "direccion"></td> </center>
    </tr>
    <tr>
    <center><td><strong>Cedula de Identidad</strong>  </td></center>
    <center><td> <input type="text" name="cedula" id = "cedula"></td> </center>
    </tr>
    <tr>
    <center><td><strong>Correo Electronico</strong>  </td></center>
    <center><td> <input type="text" name = "correo" id = "correo"></td> </center>
    </tr>
    </table><br>
    <table border="2px">
    <tr>
      <center><td><strong>Materias</strong>  </td></center>
      <center><td><Strong>Notas<strong>  </td></center>
      </tr>
      <tr>
      <center><td>Matematicas  </td></center>
      <center><td><strong> 01 </strong> </td> </center>
      </tr>
      <tr>
      <center><td>Fisica  </td></center>
      <center><td><strong> 15 </strong> </td> </center>
      </tr>
      <tr>
      <center><td>Quimica   </td></center>
      <center><td><strong> 20 </strong> </td> </center>
      <tr>
      <center><td><strong>Numero de Materias Reprobadas  </strong></td></center>
      <center><td> <input type="text" name = "correo" id = "numerodemateriasreprobadas"></td> </center>
 
    </tr>
    </table>
    <p><center><strong> El costo de el trimestre es de 150$ Americanos</strong></center></p>
    <p><center><strong> Nota: Si uste reprobo 1 materia, ira un incremento del 10%, si ha reprobo dos un 20% y si reprobo 3  no podra inscribirse</strong></center></p>
 
    <input type="image" src="enviar.jpg" alt="enviar" onclick="getdata()" width="300" height="100">
 
    <script type="text/javascript">
    alert ("Bienvenidos a la UBA");
    </script>
    </form>
  </body>
 
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de joel
Val: 3.506
Oro
Ha mantenido su posición en JavaScript (en relación al último mes)
Gráfica de JavaScript

Enlazar mi archivo HTML con Java Script

Publicado por joel (895 intervenciones) el 20/02/2020 19:50:25
Hola Walter, haber si te sirve esto...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
  <head>
    <title>Inscripcion del Estudiante</title>
  </head>
  <body background= "e11.jpg">
    <form name ="registro">
    <center><h1> Inscribete en nuestra Universidad </h1></center>
    <p><center>Queremos probar contigo nuestro nuevo sistema de inscripcion mediante este sencillo formulario que tienes que llenar </center</p>
    <table border="2px">
    <tr>
     <br><center><td><strong> Nombre del Estudiante</strong></td></center><br>
     <center><td> <input type="text" name ="nombre" id = "nombre"></td> </center>
    </tr>
    <tr>
      <br><center><td><strong> Apellido del Estudiante</strong> </td></center><br>
      <center><td> <input type="text" name = "apellido" id= "apellido"></td> </center>
    </tr>
    <tr>
    <center><td><strong> Numero de Telefono del Estudiante</strong>  </td></center>
    <center><td> <input type="text" name = "telefono" id = "telefono"></td> </center>
    </tr>
    <tr>
    <center><td><strong> Direccion del Estudiante</strong>  </td></center>
    <center><td> <input type="text" name = "direccion" id = "direccion"></td> </center>
    </tr>
    <tr>
    <center><td><strong>Cedula de Identidad</strong>  </td></center>
    <center><td> <input type="text" name="cedula" id = "cedula"></td> </center>
    </tr>
    <tr>
    <center><td><strong>Correo Electronico</strong>  </td></center>
    <center><td> <input type="text" name = "correo" id = "correo"></td> </center>
    </tr>
    </table><br>
    <table border="2px">
    <tr>
      <center><td><strong>Materias</strong>  </td></center>
      <center><td><Strong>Notas<strong>  </td></center>
      </tr>
      <tr>
      <center><td>Matematicas  </td></center>
      <center><td><strong> 01 </strong> </td> </center>
      </tr>
      <tr>
      <center><td>Fisica  </td></center>
      <center><td><strong> 15 </strong> </td> </center>
      </tr>
      <tr>
      <center><td>Quimica   </td></center>
      <center><td><strong> 20 </strong> </td> </center>
      <tr>
      <center><td><strong>Numero de Materias Reprobadas  </strong></td></center>
      <center><td> <input type="text" name = "correo" id = "numerodemateriasreprobadas" onkeyup="calcular(this)"></td> </center>
 
    </tr>
    </table>
    <p><center><strong> El costo de el trimestre es de <span id='importe'>150</span>$ Americanos</strong></center></p>
    <p><center><strong> Nota: Si uste reprobo 1 materia, ira un incremento del 10%, si ha reprobo dos un 20% y si reprobo 3  no podra inscribirse</strong></center></p>
 
    <input type="image" src="enviar.jpg" alt="enviar" onclick="getdata()" width="300" height="100">
 
    <script>
    //alert ("Bienvenidos a la UBA");
 
    function calcular(e) {
        idImporte=document.getElementById("importe");
        console.log(e.value);
        if (e.value=="1") {
            idImporte.textContent=150*1.10;
        } else (el.value=="2") {
            idImporte.textContent=150*1.30;
        } else {
            idImporte.textContent=150;
        }
    }
    </script>
    </form>
  </body>
 
</html>

te cambia el importe dependiendo de si pone 1 o 2 materias reaprobadas
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Enlazar mi archivo HTML con Java Script

Publicado por Walter (2 intervenciones) el 20/02/2020 20:05:49
Buenas, me arroja los resultados en la consola. Yo lo que quiero es que me arroje resultados pero en una tabla html a otro archivo js, pero tu codigo si funciona!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de joel
Val: 3.506
Oro
Ha mantenido su posición en JavaScript (en relación al último mes)
Gráfica de JavaScript

Enlazar mi archivo HTML con Java Script

Publicado por joel (895 intervenciones) el 21/02/2020 07:16:54
Hola Walter, lo que hace el código es cambiar el importe según el numero de materias reprobadas... no envió nada a la consola!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar