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

339
Views
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
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!