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

678
Views
Error de referencia no detectado: mi función () no está definida en HTMLButtonElement.onclick

El propósito es: cuando el usuario busque cualquier palabra clave en Google de mi sitio, se mostrará este botón. Al hacer clic en este botón se mostrará el código.

El error se muestra como:

Error de referencia no capturado: la cuenta regresiva de inicio no está definida en HTMLButtonElement.onclick

Estaba definiendo la función startcountdown antes de llamarla. ¿Alguien puede ayudarme? Muchas gracias.

 var referrer = document.referrer; ifm_list_browser = ['google.com', 'google.com.vn']; function checkFefer(f, e) { var i = 0; for (i = 0; i < e.length; i++) { if (f.indexOf(e[i]) > -1) return true; } return false; } function startcountdown() { document.getElementById('countDown40').setAttribute("style", "background: #0b1df5;border-radius: 10px;border:none;color: #ffffff;width: 59%;padding: 10px 0;text-transform: uppercase;font-weight: bold;font-size: 16px;outline: none; cursor: pointer;"); let cNode = jQuery("#references40"); let cKey = cNode.attr('code-ref'); let cCount = cNode.attr('countdown'); let counter = parseInt(cCount) || 40; var countdownCode = setInterval(function() { counter--; document.getElementById('countDown40').innerHTML = 'The code will show ' + counter + ' second' + '... Waiting...'; if (counter == 0) { document.getElementById('countDown40').innerHTML = `Your code is: ${stores[cKey]}`; document.getElementById('countDown40').setAttribute("style", "background: #ea3b7b;border-radius: 10px;border:none;color: #ffffff;width: 59%;padding: 10px 0;text-transform: uppercase;font-weight: bold;font-size: 16px;outline: none; cursor: pointer;"); clearInterval(countdownCode); return false; } }, 1000); } let stores = { 'ref48': '12344', 'ref49': 'some thing', 'ref50': 'happy polla', 'ref51': '343596', } var flagref = checkFefer(referrer, ifm_list_browser) if (flagref) { var html = '<p style="text-align:center;"><button style="background: #e81e1e;border-radius: 10px;border:none;color: #ffffff;width: 59%;padding: 10px 0;text-transform: uppercase;font-weight: bold;font-size: 16px;outline: none; cursor: pointer;" id="countDown40" get-code="true" class="coundownmobile" onclick="startcountdown(); this.onclick=null;">Get code</button></p>'; jQuery(document).ready(function($) { $("#references40").empty(); html = $.parseHTML(html); $("#references40").append(html); }); }
 <div id="references40" code-ref="ref51" countdown="8" style="text-align: center; font-weight: 600;"> Button will appear when search in Google </div>

about 4 years ago · Santiago Trujillo
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!