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

92
Views
cómo capturar el mensaje que se muestra en el cuadro de alerta

Aquí necesito recibir el mensaje que se muestra en el cuadro de alerta y hacer clic en Aceptar usando javascript.

por ejemplo: alerta("hola");

arriba, ese código muestra un mensaje como hola que proviene de otro sitio web. Necesito capturar ese mensaje usando javascript y script para obtener el mensaje y presionar el botón.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

puedes usar de esta manera:

 function captureAlert() { // get all scripts var elem = document.scripts; // loop and check for (var i = 0, len = elem.length; i < len; i++) { var txt = elem[i].textContent.match(/alert\(['"]([^'"]+)['"]\)/); if (txt) { return txt[1]; } // if matched, return the alert value } }
about 4 years ago · Juan Pablo Isaza Report

0

Simplemente puede sobrescribir la función de alerta .

 var fn = alert; alert = function(text) { document.write('<b>'+text+'</b>') alert = fn; }
 <button onclick="alert('hello123')">Click</button>

about 4 years ago · Juan Pablo Isaza Report
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!