Bienvenido a mi site personal, donde encontrarás un blog sobre mis proyectos y experiencias en el mundo de internet y la programación web.

Al mismo tiempo podrás ver mi portfolio profesional y personal, con una infinidad de trabajos que he realizado y proyectos en los que he colaborado.

Mas Sobre mi Ver mi trabajo

funciones Javascript – setInterval() clearInterval() setTimeout()

ESTE POST HA SIDO ACTUALIZADO Y TRADUCIDO, CONSULTARLO EN: funciones Javascript – setInterval() clearInterval() setTimeout() – Parte 2 setInterval() This method is used to repeatedly execute a function at a set interval. The format for this method is: window.setInterval(“functionName()”,time); The first parameter (“functionName()”) is the name of the function that you want to have executed. Notice that the function name is in quotes. It’s treated as a string to prevent it from executing immediately. The second parameter (time) is the amount of the delay in milliseconds, between each time the function is executed (1 minute = 60000 milliseconds). This is useful in animation, for rotating pictures in a gallery or perhaps refreshing the screen. For instance, to reload a page after an interval of 10 minutes (600,000 milliseconds), try this script: function reFresh() {   location.reload(true) } window.setInterval(“reFresh()”,600000); clearInterval() This method is used to stop the timed loop which was started with the setInterval() method above. The format is: window.clearInterval(varName); In order to use it, the loop must be assigned to a variable. Let’s go back to our page refresh script above. We only need to add the var reserved word in front of the setInterval() loop: function reFresh() { [...]