PROYECTO
EJERCICIO.HTML
<!doctype html> <!-- Website Template by freewebsitetemplates.com --> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Nuestro Proyecto Decimo B</title> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/mobile.css" media="screen and (max-width : 568px)"> <script type="text/javascript" src="js/mobile.js"></script> </head> <body> </div> <br> <div id="hola" align="left"></div> <div id="header"> <a href="index.html" class="logo"> <img src="images/logo.jpg" alt=""> </a> <ul id="navigation"> <li> <a href="index.html">Inicio</a> </li> <li> <a href="derechos.html">Derechos</a> </li> <li class="selected"> <a href="ejercicio.html">Ejercicio</a> </li> </ul> </div> <div id="body"> <h1><span>Ejercicio-proyecto</span></h1> </div> <script> function romano(){ var a = document.getElementById("num").value; if (a == 1) {document.getElementById("hola").innerHTML = "I"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 2) {document.getElementById("hola").innerHTML = "II"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 3) {document.getElementById("hola").innerHTML = "III"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 4) {document.getElementById("hola").innerHTML = "IV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 5) {document.getElementById("hola").innerHTML = "V"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 6) {document.getElementById("hola").innerHTML = "VI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 7) {document.getElementById("hola").innerHTML = "VII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 8) {document.getElementById("hola").innerHTML = "VIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 9) {document.getElementById("hola").innerHTML = "IX"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 10) {document.getElementById("hola").innerHTML = "X"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 11) {document.getElementById("hola").innerHTML = "XI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 12) {document.getElementById("hola").innerHTML = "XII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 13) {document.getElementById("hola").innerHTML = "XIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 14) {document.getElementById("hola").innerHTML = "XIV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 15) {document.getElementById("hola").innerHTML = "XV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 16) {document.getElementById("hola").innerHTML = "XVI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 17) {document.getElementById("hola").innerHTML = "XVII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 18) {document.getElementById("hola").innerHTML = "XVIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 19) {document.getElementById("hola").innerHTML = "XIX"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 20) {document.getElementById("hola").innerHTML = "XX"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 21) {document.getElementById("hola").innerHTML = "XXI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 22) {document.getElementById("hola").innerHTML = "XXII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 23) {document.getElementById("hola").innerHTML = "XXIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 24) {document.getElementById("hola").innerHTML = "XXIV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 25) {document.getElementById("hola").innerHTML = "XXV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 26) {document.getElementById("adios").innerHTML = "XXVI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 27) {document.getElementById("adios").innerHTML = "XXVII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 28) {document.getElementById("adios").innerHTML = "XXVIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 29) {document.getElementById("adios").innerHTML = "XXIX"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 30) {document.getElementById("adios").innerHTML = "XXX"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 31) {document.getElementById("adios").innerHTML = "XXXI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 32) {document.getElementById("adios").innerHTML = "XXXII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 33) {document.getElementById("adios").innerHTML = "XXXIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 34) {document.getElementById("adios").innerHTML = "XXXIV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 35) {document.getElementById("adios").innerHTML = "XXXV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 36) {document.getElementById("adios").innerHTML = "XXXVI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 37) {document.getElementById("adios").innerHTML = "XXXVII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 38) {document.getElementById("adios").innerHTML = "XXXVIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 39) {document.getElementById("adios").innerHTML = "XXXIX"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 40) {document.getElementById("adios").innerHTML = "XL"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 41) {document.getElementById("adios").innerHTML = "XLI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 42) {document.getElementById("adios").innerHTML = "XLII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 43) {document.getElementById("adios").innerHTML = "XLIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 44) {document.getElementById("adios").innerHTML = "XLIV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 45) {document.getElementById("adios").innerHTML = "XLV"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 46) {document.getElementById("adios").innerHTML = "XLVI"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 47) {document.getElementById("adios").innerHTML = "XLVII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 48) {document.getElementById("adios").innerHTML = "XLVIII"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 49) {document.getElementById("adios").innerHTML = "XLIX"; document.getElementById("error").innerHTML = "<hidden>"} else if (a == 50) {document.getElementById("adios").innerHTML = "L"; document.getElementById("error").innerHTML = "<hidden>"} else {document.getElementById("error").innerHTML = "<img src='images/ejercicio.png' width=670 height=400> <br><H1>(No digite numeros decimales)</H1>"; document.getElementById("hola").innerHTML = "<hidden>"; document.getElementById("adios").innerHTML = "<hidden>"} } function validar(e) { tecla = (document.all) ? e.keyCode : e.which; if (tecla==13) {javascript:romano();} } </script> </head> <body> <div id="hola"></div> <!-- Para que funcione al dar enter, tuve que quitarle el <form> :/ --> <center> <label for="numero">Digite un numero del 1 al 50</label> <input type="number" min="1" max="50" id="num" onkeypress="validar(event);"> <input type="button" value="Oprimir" onclick="javascript:romano();"> </center> <!-- </form> --> <br><br><br><br><br><br><br><br><div id="error" align="center"></div> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><div id="adios" align="right"></div> <div id="footer"> <div> <p>© 2023 by Mustacchio. All rights reserved.</p> <ul> <li> <a href="http://freewebsitetemplates.com/go/twitter/" id="twitter">twitter</a> </li> <li> <a href="http://freewebsitetemplates.com/go/facebook/" id="facebook">facebook</a> </li> <li> <a href="http://freewebsitetemplates.com/go/googleplus/" id="googleplus">googleplus</a> </li> <li> <a href="http://pinterest.com/fwtemplates/" id="pinterest">pinterest</a> </li> </ul> </div> </div> </body> </html>
Comentarios
Publicar un comentario