Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.     function pregunta() {
  3.         var a = document.forms["validacion"]["isbn"].value;
  4.         var b = document.forms["validacion"]["titulo"].value;
  5.         var c = document.forms["validacion"]["paginas"].value;
  6.         var d = document.forms["validacion"]["precio"].value;
  7.         var e = document.forms["validacion"]["ano"].value;
  8.         var f = document.forms["validacion"]["id_idioma"].value;
  9.         var g = document.forms["validacion"]["autor"].value;
  10.         var h = document.forms["validacion"]["id_categoria"].value;
  11.         var i = document.forms["validacion"]["id_editorial"].value;
  12.  
  13.         if (a == "") {
  14.             alert("ingrese un isbn");
  15.         } else if (b == "") {
  16.             alert("ingrese un titulo");
  17.         } else if (c == "") {
  18.             alert("ingrese numero de paginas");
  19.         } else if (d == "") {
  20.             alert("ingrese un precio");
  21.         } else if (e == "") {
  22.             alert("ingrese un año");
  23.         } else if (f == "") {
  24.             alert("ingrese un idioma");
  25.         } else if (g == "") {
  26.             alert("ingrese un autor");
  27.         } else if (h == "") {
  28.             alert("ingrese una categoria");
  29.         }else if (i == "") {
  30.             alert("ingrese una editorial");
  31.         }
  32.         else {
  33.             if (confirm('¿Está seguro que desea agregar?')) {
  34.                 document.validacion.submit()
  35.             }
  36.         }
  37.     }
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement