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

123
Vistas
Remotely activating a javascript function through a php request

I am somewhat new to html/php/web-design, and i created an html page that can create a message via hovering over buttons.

<button class="letter" onmouseover="Over(65)">A</button><br>

and the javascript function, Over()

function Over(X){
    console.log("Over " + String.fromCharCode(X));
    let x = '<div class="out"><p id="text">';
    x += document.getElementById("text").innerHTML;
    x += String.fromCharCode(X);
    x += "</p></div>";
    $("div.out").replaceWith(x);
}

put simply, hover over button -> call Over() -> add letter to text

however, while exploring PHP, i got the idea to combine it with another project i had done earlier, using a function that can send chrome OS notifications. (functions at bottom)

My goal for this is to have a column of buttons on the right for letters, 2 buttons on the left for Back and Send. The Back Already works just using .slice(0, document.getElementById("text").innerHTML.length-1) Now i need to figure out how to make the send function output a notification to all other Windows/tabs i dont know if thats the right word

reference image

Page layout

If this is not enough info or if anyone needs a clearer explanation, i will take feedback <3

function notifyMe(
 body = "Notification Body",
 title = 'Notification title'
) {
 if (Notification.permission !== 'granted')
  Notification.requestPermission();
 else {
  var notification = new Notification('Notification title',{
   icon: 'icon.png',
   body: "Notification Body",
  });
  notification.onclick = function() {
   window.open('https://stackoverflow.com/');
  };
 }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You really shouldn't be using PHP and JavaScript. To make it easier, it is just one or the other. But, you can create a php tag in HTML by saying <script type=text/php> I am pretty sure, and have them communicate on the same page.

You could just use element.onmouseover = function() { // YOUR CODE HERE } and then send out a remote that gets picked up on php. I don't use php, so sorry if I can't answer how to pick the remote up on php.

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