Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
eventlistener and window.onload not working for me

I've tried several things to make it work. It worked before when I hosted it all on the same file, but now it won't work when I separated it on my script.js.

this is part of my code

var buttonStart = document.getElementById("forward");
var buttonStop = document.getElementById("stop");

buttonStart.addEventListener("click", speedup);

function speedup() {
  clearInterval(Interval);

  speed = speed + 1;

  Interval = setInterval(valuecalc, 1000 / speed);
  document.getElementById("speed").innerHTML = speed;
};

buttonStop.addEventListener("click", stopspeed);

function stopspeed() {
  clearInterval(Interval);
  speed = 0;
  document.getElementById("speed").innerHTML = speed;
};

var starts = start();
window.onload = starts;

Here's the live demo it's a sort of clicker game I'm working on: https://jobclicker.netlify.app/

This is my error: script.js:35

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') at script.js:35:17

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda