1

我在dreamveaver cs4 中制作了我的网站导航的翻转按钮。图像交换功能在 Chrome 和 firefox 浏览器中运行良好,但在 IE9 中,交换的图片显示在我将鼠标悬停在每个单元格右侧的两个单元格中。

我是网页设计的新手,如果有人可以帮助解决这个问题,我会很高兴。

enter code here
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function showmenu(elmnt)
{
document.getElementById(elmnt).style.visibility="visible";
}
function hidemenu(elmnt)
{
document.getElementById(elmnt).style.visibility="hidden";
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

<style type="text/css">
<!--

body{;margin-top: 2px;}
a{color:#FFF;text-decoration:none;font:Tahoma, Geneva, sans-serif}
a:hover{color:#FFF}
td.menu{background:#F90; text-align:center;}
table.menu
{
    width:inherit;
font-size:100%;
position:absolute;
visibility:hidden;
}
-->
</style></head>

<body onload="MM_preloadImages('EXCELNET/Home2.png','EXCELNET/About2.png','EXCELNET/Services2.png','EXCELNET/Products2.png','EXCELNET/Contactus2.png','EXCELNET/websms2.png','Pictures/Home2.png','Pictures/About2.png','Pictures/Services2.png','Pictures/Products2.png','Pictures/Contact2.png','Pictures/websms2.png')">
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2"></td>
  </tr>
  <tr>
    <td align="center" valign="top"><table border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="2" colspan="7"></td>
      </tr>
      <tr>
        <td><img src="Pictures/Excelnet Logo.png" width="72" height="25" /></td>
        <td><a href="Home.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('2','','Pictures/Home2.png',1)"><img src="Pictures/Home1.png" name="2" width="140" height="25" border="0" id="2" /></a></td>
        <td><a href="About.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('3','','Pictures/About2.png',1)"><img src="Pictures/About1.png" name="3" width="140" height="25" border="0" id="3" /></a></td>
        <td width="140" onmouseover="showmenu('services')" onmouseout="hidemenu('services')"><a href="Services.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('4','','Pictures/Services2.png',1)"><img src="Pictures/Services1.png" name="4" width="140" height="25" border="0" id="4" /></a><br>
        <table class="menu" id="services" width="120">
   <tr><td class="menu"><a href="/html/default.asp">HTML</a></td></tr>
   <tr><td class="menu"><a href="/css/default.asp">CSS</a></td></tr>
   <tr><td class="menu"><a href="/xml/default.asp">XML</a></td></tr>
   <tr><td class="menu"><a href="/xsl/default.asp">XSL</a></td></tr>
   </table>
   </td>
        <td><a href="Products.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('5','','Pictures/Products2.png',1)"><img src="Pictures/Products1.png" name="5" width="140" height="25" border="0" id="5" /></a></td>
        <td><a href="Contacts.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('6','','Pictures/Contact2.png',1)"><img src="Pictures/Contact1.png" name="6" width="140" height="25" border="0" id="6" /></a></td>
        <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('8','','Pictures/websms2.png',1)"><img src="Pictures/websms1.png" name="8" width="140" height="25" border="0" id="8" /></a></td>
      </tr>
    </table></td>
    <td rowspan="3" align="center" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td height="5" align="center" valign="top"></td>
  </tr>
  <tr>
    <td align="center" valign="top"><img src="Pictures/Desktop Computer2.jpg" alt="" width="870" height="379" /></td>
  </tr>
  <tr>
    <td height="5" colspan="2"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table width="865" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">&copy;2012 EXCELNET SYSTEM</font> &nbsp;&nbsp;&nbsp;<font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">|</font> &nbsp;&nbsp;<font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">Terms & Conditions </font>&nbsp;&nbsp;<font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">|</font> &nbsp;&nbsp;<font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">About </font>&nbsp;&nbsp;<font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">|</font> &nbsp;&nbsp;<font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">Contacts </font>&nbsp;&nbsp;<font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">| </font>&nbsp;&nbsp;<font face="Verdana, Geneva, sans-serif" color="#F37214" size="2pt">Feedback</font></td>
  </tr>
</table></td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
4

2 回答 2

0

问题是您为 ID 属性使用了数值。如果您在前面加上一个字母,那么您的翻转将起作用。以下是有关 HTML ID 属性的更多信息: https ://stackoverflow.com/a/79022/1622684

于 2012-10-09T13:02:29.417 回答
-1

请试试这个..

大约第 28 行,在函数 MM_findObj(n, d) 中

换行

if(!(x=d[n])&&d.all) x=d.all[n]; 

 if(!(d[n])&&d.all) x=d.all[n];

这应该使它适用于所有浏览器。
对我来说似乎是一个拼写错误。
如果不是很奇怪。

于 2012-10-09T12:47:04.970 回答