Diferencia entre revisiones de «Usuario:RubiVGM»

De Unión PokéPRO - Wiki
Ir a la navegaciónIr a la búsqueda
Página creada con «<script type="text/javascript"> // Cambiar colores de las barras de estadísticas según el valor document.querySelectorAll('.stat-bar').forEach(function(bar) { var value = parseInt(bar.getAttribute('data-value')); // Obtener el valor de la estadística desde el atributo data-value if (value < 50) { bar.style.backgroundColor = '#ff5959'; // Rojo para valores menores a 50 } else if (value >= 50 && value < 100) { bar.style.backgroundColor =…»
 
Sin resumen de edición
Línea 1: Línea 1:
<script type="text/javascript">
<script type="text/javascript">
  // Cambiar colores de las barras de estadísticas según el valor
 
  document.querySelectorAll('.stat-bar').forEach(function(bar) {
  document.querySelectorAll('.stat-bar').forEach(function(bar) {
    var value = parseInt(bar.getAttribute('data-value')); // Obtener el valor de la estadística desde el atributo data-value
 
    if (value < 50) {
    var value = parseInt(bar.getAttribute('data-value'));  // Obtener el valor de la estadística desde el atributo data-value
      bar.style.backgroundColor = '#ff5959'; // Rojo para valores menores a 50
 
    } else if (value >= 50 && value < 100) {
    if (value < 50) {
      bar.style.backgroundColor = '#fae078'; // Naranja para valores entre 50 y 99
 
    } else {
      bar.style.backgroundColor = '#ff5959';  // Rojo para valores menores a 50
      bar.style.backgroundColor = '#a7db8d'; // Verde para valores de 100 o más
 
    }
    } else if (value >= 50 && value < 100) {
  });
 
      bar.style.backgroundColor = '#fae078';  // Naranja para valores entre 50 y 99
 
    } else {
 
      bar.style.backgroundColor = '#a7db8d';  // Verde para valores de 100 o más
 
    }
 
  });
 
</script>
</script>

Revisión del 21:44 28 ene 2025

<script type="text/javascript">

  document.querySelectorAll('.stat-bar').forEach(function(bar) {

    var value = parseInt(bar.getAttribute('data-value'));  // Obtener el valor de la estadística desde el atributo data-value

    if (value < 50) {

      bar.style.backgroundColor = '#ff5959';  // Rojo para valores menores a 50

    } else if (value >= 50 && value < 100) {

      bar.style.backgroundColor = '#fae078';  // Naranja para valores entre 50 y 99

    } else {

      bar.style.backgroundColor = '#a7db8d';  // Verde para valores de 100 o más

    }

  });

</script>