Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title></title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <style>
- h1 { font-family:courier; }
- button { color:white;background-color:navy; padding:5px 20px;
- outline:none;font-size:20px;font-weight:900; }
- .info { display:none; }
- </style>
- </head>
- <body>
- <button onclick='info()'>Display Info</button>
- <h2 class='info'>John 32 years old has broken both legs.</h2>
- <h2 class='info'>Henrietta 40 year old, single, wants to die right now.</h2>
- <h2 class='info'>Marcus 10 years old has eaten his own pet chicken.</h2>
- <h1 id='h1'></h1>
- <script>
- i=0;
- x = document.getElementsByClassName('info');
- function info(){
- del=setInterval(()=>{
- h1.innerHTML+=x[i].innerHTML+'<br>';
- h1.style.display='block';
- i++;
- if(i==x.length){
- clearInterval(del);
- setTimeout(function(){
- h1.innerHTML+='<span style="font-size:20px;font-family:courier;"><a href="https://www.w3schools.com/tags/att_global_class.asp" target="_blank">End of results.</a></span>';
- },500);
- }
- },500);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement