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

392
Views
¿Cómo inyectar código de alerta de trabajo desde un formulario de texto HTML?

Soy bastante nuevo en codificación en JavaScript y desarrollo web, y me preguntaba si había alguna forma de ingresar una alerta a través de un formulario de texto HTML y hacer que se ejecute en otra página después de que se haya enviado, en este momento esto es lo que tengo.

índice.html

 <!DOCTYPE html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>form</title> </head> <body> <form action="results.html" method="GET"> <div> <label>Name</label> <input style="width: 400px;" size=400px type="text" name="name" id="name" placeholder="username" required> </div> <button type="reset">Reset</button> <button type="submit">Submit</button> </form> </body>

resultados.html

 <!DOCTYPE html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Results</title> </head> <body> <div id="results"></div> <a href="index.html">Back to Form</a> <script> const resultsList = document.getElementById('results') new URLSearchParams(window.location.search).forEach((value, name) => { resultsList.append(`${name}: ${value}`) resultsList.append(document.createElement('br')) }) </script> </body>

quiero conseguir algo como esto

mi entrada

Lo que estoy tratando de lograr

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

0

Tienes que recibir una variable que envías con el método "get".

Con el objeto window.location. Este código te da GET sin el signo de interrogación.

 let myTextAlert = window.location.search.substr(1)

(Puedes usar el método split() para deshacerte de &)

Siguiente en Tu div o inserta js:

 <div id="results"> <script> alert("This page Says:" + myTextAlert); </script> </div>
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!