Class
Class
DOCTYPE html>
<head>
</head>
<body>
<script>
func on show()
{
document.getElementById("p1").innerHTML="welcome to css";
}
func on display()
{
document.write("hello");
}
</script>
<p id="p1"></p>
<p id="p2"></p>
<input type="bu on" value="setTimeout" onclick="setTimeout(show,1000)">
<br>
<br>
<input type="bu on" value="setInterval" onclick="setInterval(display,1000)">
</body>
</html>
Output:
clearTimeout:
<!DOCTYPE html>
<head>
</head>
<body>
<script>
func on display()
{
document.getElementById("p2").innerHTML="hello";
}
</script>
<p id="p2"></p>
<input type="bu on" value="strat" onclick=" setTimeout(display,1000);">
<input type="bu on" value="stop" onclick="clearTimeout(a);">
</body>
</html>
Output:
clearInterval:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF‐8">
<meta name="viewport" content="width=device‐width, ini al‐scale=1.0">
< tle>Document</ tle>
</head>
<body>
<script>
func on display()
{
const a=new Date();
document.getElementById("p2").innerHTML=a.toLocaleTimeString();
}
</script>
<p id="p2"></p>
<input type="bu on" value="strat" onclick=" setInterval(display,1000);">
<input type="bu on" value="stop" onclick="clearInterval(a);">
</body>
</html>
Outpu: