logoExtra: script.Reloj_analógico_configurable_svg

Descripción: Inicialización para poder enviar el formulario a un popup, e inicializar los distintos controles del mismo.


A continuación mostramos los apuntes asociados a este extra:

Reloj analógico configurable svg
Después de comprobar con qué facilidad se puede dibujar un sencillo reloj analógico decidimos poderlo configurar; y a la vez compartirlo.
// Descripción para sindicación:
/*
    [rss]Inicialización para poder enviar el formulario a un popup, e inicializar los distintos controles del mismo.[/rss]
*/

function habilitar_hora(no)    {
    tag("hh").disabled = no;
    tag("mm").disabled = no;
    tag("ss").disabled = no;
}

poner_evento(window, "load",
    function() {
        tag("svg_v").disabled = false;
        tag("svg_f").disabled = true;
        tag("svg_e").disabled = true;
        tag("svg_p").disabled = true;
        tag("svg_h").disabled = true;
        tag("svg_m").disabled = true;
        tag("svg_s").disabled = true;
        tag("cambiar_hn").disabled = false;
        tag("hh").disabled = true;
        tag("mm").disabled = true;
        tag("ss").disabled = true;
        poner_evento(tag("reloj_svg"), "submit",
            function() {
                if (tag("svg_v").checked)
                    this.target = "_blank"
                else
                    this.target = "reloj_svg";
                for (i = 0, total = this.gmt.length; i < total; i++)    {
                    if (this.gmt[i].checked)    {
                        if (this.gmt[i].value == 0)    {
                            ya = new Date();
                            this.hh.value = ya.getHours();
                            this.mm.value = ya.getMinutes();
                            this.ss.value = ya.getSeconds();
                        };
                        this.gmt[i].checked = false;
                    }
                }
            }
        )

        poner_evento(tag("cambiar_f"), "change",
            function() {
                tag("svg_f").disabled = !this.checked;
                if (this.checked) tag("svg_f").focus();
            }
        )

        poner_evento(tag("cambiar_e"), "change",
            function() {
                tag("svg_e").disabled = !this.checked;
                if (this.checked) tag("svg_e").focus();
            }
        )

        poner_evento(tag("cambiar_p"), "change",
            function() {
                tag("svg_p").disabled = !this.checked;
                if (this.checked) tag("svg_p").focus();
            }
        )

        poner_evento(tag("cambiar_h"), "change",
            function() {
                tag("svg_h").disabled = !this.checked;
                if (this.checked) tag("svg_h").focus();
            }
        )

        poner_evento(tag("cambiar_m"), "change",
            function() {
                tag("svg_m").disabled = !this.checked;
                if (this.checked) tag("svg_m").focus();
            }
        )

        poner_evento(tag("cambiar_s"), "change",
            function() {
                tag("svg_s").disabled = !this.checked;
                if (this.checked) tag("svg_s").focus();
            }
        )

        poner_evento(tag("cambiar_hs"), "change",
            function() {
                habilitar_hora(true);
            }
        )

        poner_evento(tag("cambiar_hn"), "change",
            function() {
                habilitar_hora(true);
            }
        )

        poner_evento(tag("cambiar_hd"), "change",
            function() {
                habilitar_hora(false);
            }
        )

    }
);

Este código ha sido leído en 79 ocasiones.

Zona de comentarios

Esta extra aún no tiene comentarios.

Evaluación

Valoración de esta página: (extra.script.Reloj_analógico_configurable_svg) valor

Valoración evaluar evaluar evaluar evaluar evaluar evaluar evaluar evaluar evaluar evaluar

Respuesta: Zona de mensajes (proceso de evaluación)

Listados: imágenes, categorías, etiquetas, extras | Anuarios: 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 | Otros enlaces: buscador