源码如下,如遇调试问题,可以找我解决:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>JS查看示例图(鼠标移动显示,移开隐藏)</title> <script type="text/javascript"> function over(){ img = document.getElementById("Example"); img.style.display = "block"; } function out(){ img = document.getElementById("Example"); img.style.display = "none"; } </script> </head> <body> <form id="form1" runat="server"> <div id="right" align="left"> <table style="TABLE-LAYOUT: fixed; WIDTH: 593pt; BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0" width="860" border="1"> <tr> <td colSpan="4" id="ExamplePhoto" align="center"> <p onmouseover="over()" onmouseout = "out()"><span style="font-weight:bold;color:Red;text-decoration:underline;">点我查看示例</span></p> <img src="../Img/LoginPhoto.jpg" id="Example" width="750" height="250"/> </td> </tr> </table> </div> </form> </body> </html>
示例图如下,当鼠标移动时显示:
当鼠标移开时,自动隐藏图片: