您正在使用Images/home.png
图像位置的相对 URL,将其更改为 absolute /Images/home.png
:
<a runat="server" href="home.htm" onmouseover="document.Home_Img.src='/Images/home_2.png'"
onmouseout="document.Home_Img.src='/Images/home.png'">
<img alt="" src="/Images/home.png" name="Home_Img" runat="server" />
</a>
此外,这与 CSS 无关,因为您使用的是老式 Javascript 鼠标悬停。我强烈建议您将其更改为:
<style>
a.home {
background: url(/Images/home.png) no-repeat;
display: block; /* this may not be correct, depends on the layout */
height: 100px; /* height of image */
text-indent: 9999px;
width: 100px; /* width of image */
}
a.home:hover {
background: url(/Images/home_2.png) no-repeat;
}
</style>
<a class="home" href="home.htm">Home</a>