vista.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright (C) 2021 echedey
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. -->
  15. <html lang="es">
  16. <head>
  17. <meta charset="UTF-8" />
  18. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  19. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
  20. <meta name="author" content="Echedey López Romero" />
  21. <title>Calculadora Aritmética</title>
  22. <link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css" />
  23. <script src="./jquery/jquery-3.5.1.slim.min.js"></script>
  24. <script src="./bootstrap/js/bootstrap.bundle.min.js"></script>
  25. <style>
  26. .centro {
  27. text-align: center;
  28. }
  29. .derecha {
  30. text-align: right;
  31. }
  32. /* Chrome, Safari, Edge, Opera */
  33. input::-webkit-outer-spin-button,
  34. input::-webkit-inner-spin-button {
  35. -webkit-appearance: none;
  36. margin: 0;
  37. }
  38. /* Firefox */
  39. input[type=number] {
  40. -moz-appearance: textfield;
  41. }
  42. </style>
  43. <script>
  44. function Limpiar() {
  45. let Operadores = document.getElementsByTagName("input");
  46. for (let Pos = 0; Pos < Operadores.length; Pos++) {
  47. Operadores[Pos].setAttribute("value", "");
  48. }
  49. let ResultadoTitle = document.getElementById("resultadotitle");
  50. let Resultado = document.getElementById("resultado");
  51. ResultadoTitle.textContent = "Resultado";
  52. Resultado.textContent = "--";
  53. }
  54. </script>
  55. </head>
  56. <body class="container">
  57. <div class="row my-3">
  58. <div class="col-lg-3 col-md-2 col-sm-1"></div>
  59. <div class="col-lg-6 col-md-8 col-sm-10 col-xs-12 border border-primary rounded p-3">
  60. <h1 class="centro">Calculadora Aritmética</h1>
  61. <form action="./index.php" method="POST" class="mb-2">
  62. <div class="form-group">
  63. <label class="d-block centro" for="operadorprimario">Primer número</label>
  64. <input type="number" name="operadorprimario" id="operadorprimario"
  65. value="<?php echo($OperadorPrimario) ?>" placeholder="0" step="0.1"
  66. required class="form-control form-control-lg derecha" />
  67. </div>
  68. <div class="form-group">
  69. <label class="d-block centro" for="operadorsecundario">Segundo número</label>
  70. <input type="number" name="operadorsecundario" id="operadorsecundario"
  71. value="<?php echo($OperadorSecundario) ?>" placeholder="0" step="0.1"
  72. required class="form-control form-control-lg derecha" />
  73. </div>
  74. <span id="resultadotitle" class="d-block mb-2 centro"><?php echo($ResultadoTitle) ?></span>
  75. <p id="resultado" class="border border-secondary rounded p-2 centro"><?php echo($Resultado) ?></p>
  76. <div class="container">
  77. <div class="row">
  78. <div class="col-lg-8 col-md-12 p-0 pr-lg-2 mb-2 mb-lg-0">
  79. <div class="container">
  80. <div class="row mb-2">
  81. <div class="col-6 p-0 pr-2">
  82. <button type="submit" name="operacion" value="sumar"
  83. class="btn btn-primary btn-lg btn-block">Sumar</button>
  84. </div>
  85. <div class="col-6 p-0">
  86. <button type="submit" name="operacion" value="restar"
  87. class="btn btn-primary btn-lg btn-block">Restar</button>
  88. </div>
  89. </div>
  90. <div class="row mb-2">
  91. <div class="col-6 p-0 pr-2">
  92. <button type="submit" name="operacion" value="multiplicar"
  93. class="btn btn-primary btn-lg btn-block">Multiplicar</button>
  94. </div>
  95. <div class="col-6 p-0">
  96. <button type="submit" name="operacion" value="dividir"
  97. class="btn btn-primary btn-lg btn-block">Dividir</button>
  98. </div>
  99. </div>
  100. <div class="row">
  101. <div class="col-6 p-0 pr-2">
  102. <button type="submit" name="operacion" value="potencia"
  103. class="btn btn-primary btn-lg btn-block">Potencia</button>
  104. </div>
  105. <div class="col-6 p-0">
  106. <button type="submit" name="operacion" value="raiz"
  107. class="btn btn-primary btn-lg btn-block">Raíz</button>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <div class="col-lg-4 col-md-12 p-0">
  113. <button type="reset" style="height: 100%"
  114. class="btn btn-danger btn-lg btn-block"
  115. onclick="Limpiar()">Limpiar</button>
  116. </div>
  117. </div>
  118. </div>
  119. </form>
  120. </div>
  121. <div class="col-lg-3 col-md-2 col-sm-1"></div>
  122. </div>
  123. </body>
  124. </html>