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

211
Views
¿Cómo puedo abrir una ventana después de hacer clic en un botón personalizado?

Obtuve este código para un sitio web que usa Tampermonkey y quiero que se abra una ventana en el centro de la pantalla después de presionar el botón. ¿Cómo puedo hacer eso?

 (function() { 'use strict'; //button var button = document.createElement("button"); button.setAttribute("class", "mdl-button mdl-js-button geofs-f-standard-ui"); button.setAttribute("id", "Button-toggle"); button.setAttribute("style", "background:clear"); button.innerHTML = "test"; document.getElementsByClassName("geofs-ui-bottom")[0].appendChild(button); var buttonToggle = document.getElementById("Button-toggle"); //Event Listener buttonToggle.addEventListener("click", function() { buttonToggle.setAttribute("style", "background:green"); console.log("Button Pressed"); }); })();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede abrir una nueva ventana con JavaScript. Funciona bien en el lápiz de código. https://codepen.io/ash_000001/pen/PoORmyg

Puede cambiar la posición con esta línea de código:

 const myWin = window.open("", "", "left=700, top=350, width=200, height=100"); 

 function myFunction() { const myWin = window.open("", "", "left=700, top=350, width=200, height=100"); let x = myWin.screenX; let y = myWin.screenY; document.getElementById("ao").innerHTML = "myWin.screenX= " + x + "<br>myWin.screenY= " + y; }
 <button onclick="myFunction()">Open Window</button> <p id="ao"></p>

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!