"JavaScript can be executed in time-intervals. This is called timing events.
The window object allows execution of code at specified time intervals.
These time intervals are called timing events.
The two key methods to use with JavaScript are:
setTimeout(function, milliseconds)
Executes a function, after waiting a specified number of milliseconds.
setInterval(function, milliseconds)
Same as setTimeout(), but repeats the execution of the function continuously."
by W3C School
<script type="text/javascript">
function init(){
window.setTimeout(countdown, 1000);
}
function countdown (){
alert("Hi there!");
}
</script>
The unit is milliseconds, so 1000 milliseconds = 1 second.
The window will popup in 1 second.
Feel free to comment and share your ideas below to learn together!
If you guys find this article helpful, please kindly do the writer a favor — LIKE this article.
>>: Day12 - [丰收款] 为BackendURL中收到PayToken铺路,Django来了。
连续 30 天不中断每天上传一支教学影片,教你如何用 React 加上 Firebase 打造社群...
嗨大家~ 像昨天文章里提的,这专案会采用 Notion 来当 CMS (包含资料库),意思是部落格文...
前一篇介绍了要用来作为建立Pipeline的材料,这篇就要开始来建立第一个Build Pipelin...
本篇介绍JS插件pdf.js简易应用篇 今天介绍透过插件pdf.js在网页中直接浏览pdf 官网:...
2021年很快已经倒数2个月了 这一年变动很大很快 不管是你所属的企业还是我任职的企业,很明显的,在...