javascript - Show information after mouseover on image -


i have 3 pictures on website generated way:

<!doctype html> <html lang="de">     <head>         <meta charset="utf-8">         <title>ajax</title>         <meta name="viewport" content="width=device-width; initial-scale=1.0">         <link rel="stylesheet" type="text/css" href="lib/css/stil.css" />         <script type="text/javascript" src="lib/js/ajaxeinsendeaufgabe2.js"></script>     </head>     <body>         <h1>zusatzinformationen</h1>         <table>             <tr>                 <td>                     <img class="img" src="img/b1.jpg" />                 </td>                 <td id="info0"></td>             </tr>             <tr>                 <td>                     <img class="img" src="img/b2.jpg" />                 </td>                 <td id="info1"></td>             </tr>             <tr>                 <td>                     <img class="img" src="img/b3.jpg"/>                 </td>                 <td id="info2"></td>             </tr>         </table>     </body> </html> 

my problem: how show text when move mouse on 1 of 3 images. each image must display unique text.

here incomplete part of code:

var resob = new xmlhttpsrequest (); window.onload = function () { document.getelementsbytagname("img").onmouseover = function sndreq(i){ switch (i) {     case 0:     resob.open('get', 'info0.txt', true);     break;      case 1:     resob.open('get', 'info1.txt', true);     break;      case 2:     resob.open('get', 'info2.txt', true);     break;      resob.onreadystatechange = function (){         handleresponse (i);     } 

how can generate text information each image using onmouseover event?


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -