<html> <head> <script type="text/javascript"> function gettip(txt) { document.getElementById('tip').innerHTML=txt; } function reset() { document.getElementById('tip').innerHTML=""; } </script> </head> <body> <p>Mouse over these drinks:</p> <span onmouseover="gettip('Hot black drink')" onmouseout="reset()">Coffee</span> <br /><br /> <span onmouseover="gettip('Cold white drink')" onmouseout="reset()">Milk</span> <p id="tip"></p> </body> </html>
Your Result:
Edit the code above and click to see the result.
W3Schools.com
- Try it yourself