Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
window.setInterval to start only when I click the start game button and need to get that without using functions

I want the window.setInterval to start only when I click the start game button and need to get that without calling a function for SetInterval.Right now the setInterval works as soon as the page is loaded and generates random letters.

I have tried the following code:

(The start game button)

<td style="text-align: center;" colspan="3"><button id="rndletter">Start game</button>

<script>
    document.getElementById("rndletter").addEventListener("click", window.setInterval(function() {

                var result0 = String.fromCharCode(Math.floor(Math.random() * (122 - 97)) + 97);
                

                var result1 = String.fromCharCode(Math.floor(Math.random() * (122 - 97)) + 97);
                

                var result2 = String.fromCharCode(Math.floor(Math.random() * (122 - 97)) + 97);
                

                document.getElementById("result0").innerText = result0;
                document.getElementById("result1").innerText = result1;
                document.getElementById("result2").innerText = result2;
            },2000));
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!