1

dreamveavercs4で自分のWebサイトのナビゲーションのロールオーバーボタンを作成しました。画像の交換機能はChromeとFirefoxのブラウザでは正常に機能しますが、IE9では、交換された画像は、マウスをロールオーバーしたそれぞれの右側の2つのセルに表示されます。

私はウェブデザインに不慣れで、誰かがこの問題を解決するのを手伝ってくれると嬉しいです。

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

The problem is that you have used numeric values for your ID attributes. If you prepend a letter then your rollovers will work. Here is some more information about HTML ID attributes: https://stackoverflow.com/a/79022/1622684

于 2012-10-09T13:02:29.417 に答える
-1

plsはこれを試してみてください..

〜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 に答える