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

337
Visualizações
Adding html mouseover function with javascript

I'm trying to write an html MUD game with javascript. I try to print a message that shows a picture of the character performing the action when moused over.

Here is my code so far

function printMessage(message,char){

$("#messageScreen").append('<p onmouseover="showPicBottom('+char.race+','+char.pic+')" onmouseout="removePic()">'+""+message+"</p>");

}

function showPicBottom(race,pic){
    var pichtml="";
    if (origin=="Human"){
        pichtml='<img src="img/human/'+"Pic ("+pic+")"+'.PNG"/ width="200">';
    }else{
        pichtml='<img src="img/elf/'+"Pic ("+pic+")"+'.PNG"/ width="200">';
    }
    $("#picBottom").append(pichtml);
}

I always get "Uncaught SyntaxError: Unexpected token ','" at the first function. Apparently the way I added those two variables was wrong. I think it's the quotation marks but I haven't found a way. How do I fix it?

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