Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda