I checked many posts, but looks all different and none of solutions work for me, the following is an extreme simple example, img1_click works in the newest Chrome with mouse click on desktop, but on touchscreen the img1_clickis never called, and I could see:
uncaught referenceerror img1_click is not defined
I found this post which suggests:
document.getElementById ('img1').addEventListener ("click", img1_click, false);
However, it is still not working!
I define function img1_click in a JavaScript file and it is loaded in this .html file:
 <table >
 <td width="280">
 ...
 </td>
 <td width="280">
 <p id="img1" 
 style="width:280px;height:157px;
 background:url(images/1.bmp);background-size: 280px 157px;"onclick="img1_click()">
  </p>
  </td>`
There is a link to https://tommcfarlin.com/javascript-reference-error-is-not-defined/ to discuss this, it means sometimes HTML could not recognize or define the function, which is in JavaScript.
 
     
     
    