domingo, 15 de febrero de 2026

TRATADO DE PAZ

 [COPIA *]

Este código HTML5, CSS y JavaScript proporciona una interfaz interactiva de código abierto para votar sobre el «Proyecto Ozono Euro Aforo», centrado en un tratado de paz internacional. Incluye diseño responsivo, almacenamiento local de votos y visualización de resultados.

<!DOCTYPE html>

<html lang="es">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Votación Proyecto Ozono Euro Aforo</title>

    <style>

        body { font-family: Arial, sans-serif; max-width: 600px; margin: 20px auto; padding: 20px; background-color: #f4f4f9; }

        .container { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }

        h1 { color: #2c3e50; text-align: center; }

        button { padding: 10px 20px; margin: 10px; cursor: pointer; border: none; border-radius: 5px; font-size: 16px; }

        .btn-yes { background-color: #27ae60; color: white; }

        .btn-no { background-color: #c0392b; color: white; }

        .results { margin-top: 20px; font-weight: bold; text-align: center; }

        .bar { height: 20px; margin-top: 5px; }

        #bar-yes { background-color: #27ae60; }

        #bar-no { background-color: #c0392b; }

    </style>

</head>

<body>


<div class="container">

    <h1>Votación: Tratado de Paz y Proyecto Ozono Euro Aforo</h1>

    <p>¿Aprueba usted el proyecto para la gestión atmosférica conjunta y el aforo europeo de paz?</p>

    

    <div style="text-align: center;">

        <button class="btn-yes" onclick="votar('yes')">Sí, Aprobar</button>

        <button class="btn-no" onclick="votar('no')">No, Rechazar</button>

    </div>


    <div class="results">

        <p>Resultados Actuales:</p>

        <p>Sí: <span id="count-yes">0</span> <div class="bar" id="bar-yes" style="width: 0%"></div></p>

        <p>No: <span id="count-no">0</span> <div class="bar" id="bar-no" style="width: 0%"></div></p>

    </div>

</div>


<script>

    // Inicializar votos desde localStorage

    let votos = JSON.parse(localStorage.getItem('votosOzono')) || { yes: 0, no: 0 };


    function actualizarInterfaz() {

        document.getElementById('count-yes').innerText = votos.yes;

        document.getElementById('count-no').innerText = votos.no;

        

        let total = votos.yes + votos.no;

        if (total > 0) {

            document.getElementById('bar-yes').style.width = (votos.yes / total * 100) + '%';

            document.getElementById('bar-no').style.width = (votos.no / total * 100) + '%';

        }

    }


    function votar(opcion) {

        votos[opcion]++;

        localStorage.setItem('votosOzono', JSON.stringify(votos));

        actualizarInterfaz();

        alert('Voto registrado por ' + (opcion === 'yes' ? 'Aprobar' : 'Rechazar'));

    }


    // Cargar resultados al iniciar

    actualizarInterfaz();

</script>


</body>

</html>




No hay comentarios:

Publicar un comentario

PREFERENCIAS

Acceso Web Agencia

Para crear un elemento en HTML que combine texto e imagen y funcione como una pestaña (tab) o enlace, la forma más estándar es utilizar un e...