<!DOCTYPE html>
<html>
<body>
<button onclick="timedText()">Try it</button>
<p id="demo">Click on "Try it". I will display when two, four, and six seconds have passed.</p>
<script>
function timedText() {
setTimeout(myTimeout1, 2000)
setTimeout(myTimeout2, 4000)
setTimeout(myTimeout3, 6000)
}
function myTimeout1() {
document.getElementById("demo").innerHTML = "2 seconds";
}
function myTimeout2() {
document.getElementById("demo").innerHTML = "4 seconds";
}
function myTimeout3() {
document.getElementById("demo").innerHTML = "6 seconds";
}
</script>
</body>
</html>
<html>
<body>
<button onclick="timedText()">Try it</button>
<p id="demo">Click on "Try it". I will display when two, four, and six seconds have passed.</p>
<script>
function timedText() {
setTimeout(myTimeout1, 2000)
setTimeout(myTimeout2, 4000)
setTimeout(myTimeout3, 6000)
}
function myTimeout1() {
document.getElementById("demo").innerHTML = "2 seconds";
}
function myTimeout2() {
document.getElementById("demo").innerHTML = "4 seconds";
}
function myTimeout3() {
document.getElementById("demo").innerHTML = "6 seconds";
}
</script>
</body>
</html>
No comments:
Post a Comment