Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
Last active April 4, 2024 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lambdamusic/4734408 to your computer and use it in GitHub Desktop.
Save lambdamusic/4734408 to your computer and use it in GitHub Desktop.
JavaScript: Running scripts ciclically #js
<html>
<body>
<input type="text" id="clock" />
<script language=javascript>
var int=self.setInterval("clock()",1000);
function clock()
{
var d=new Date();
var t=d.toLocaleTimeString();
document.getElementById("clock").value=t;
}
</script>
</form>
<button onclick="int=window.clearInterval(int)">Stop</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment