2013-06-22 109 views
0

我正在爲一個工作朋友免費提供一個網站,顯然我的知識和經驗有限,這就是爲什麼我在這裏尋求幫助。Onmouseover IE問題

我不確定是否需要.js文件或.css文件才能使onmouseover工作;我現在完全沒有想法。

<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> 
<html> 

    <head> 
     <!-- CHANGE THE NEXT THREE LINES --> 
     <title>Parkley Visual Arts</title> 
     <meta name="Description" content="Parkley Visual Arts. Graphic Design & Art"> 
     <meta name="KeyWords" content="Graphic Design, Graphic Arts, Frame Pictures, Frame Pics, Photopgraphy, Leamington Arts, Leamington Graphics, Leamington Designs, Warwickshire Graphic Arts"> 
     <!-- CHANGE THE ABOVE THREE LINES --> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
     <META name="Copyright" content="Copyright 2013 Parkley Visual Arts"> 
     <META http-equiv="Content-Language" content="en"> 
     <META name="revisit-after" content="15 days"> 
     <META name="robots" content="index, follow"> 
     <META name="Rating" content="General"> 
     <META name="Robots" content="All"> 
     <!-- InstanceBeginEditable name="head" --> 
     <!-- InstanceEndEditable --> 
     <link rel=StyleSheet href="corporatestyle.css" type="text/css" media="screen"> 
     <script language="JavaScript" src="javascripts.js"></script> 
     <script language="JavaScript" src="pop-closeup.js"></script> 
     <script type="text/javascript"> 
      window.onload = function() { 
       "use strict"; 
       var Minilogo, Eyewinker, LearnMore; 
       Minilogo = document.getElementById('Minilogo'); 
       Eyewinker = document.getElementById('Eyewinker'); 

       Minilogo.onmouseover = function() { 
        Minilogo.src = 'Minilogo.gif'; 
       }; 
       Eyewinker.onmouseover = function() { 
        TW.src = 'Eyewinker.gif'; 
       }; 

       Minilogo.onmouseout = function() { 
        Minilogo.src = 'Minilogo.gif'; 
       }; 
       Eyewinker.onmouseout = function() { 
        Eyewinker.src = 'Eyewinker.gif'; 
       }; 
      }; 

      if (browser == "Microsoft Internet Explorer") { 
       countryListItem.attachEvent('onmouseover', sp.showPanel('item' + x), false); 
      } else { 
       countryListItem.addEventListener('mouseover', sp.showPanel('item' + x), false); 
      } 

      function swapImage(imgID, imgSrc) { 
       var theImage = document.getElementById(imgID) 
       theImage.src = imgSrc; 
      } 

      function preLoadImages() { 
       for (var i = 0; i < arguments.length; i++) { 
        var tmpImage = new Image(); 
        tmpImage.src = arguments[i]; 
       } 
      } 
     </script> 
    </head> 

    <body onload="preLoadImages('Eyewinker.gif');"> 
     <div style="text-align: center;"> 
      <center><a href="http://www.parkleyvisualarts.com/construction.htm"><img id="imgToSwap" src="Minilogo.gif" alt="animated gif" onmouseover="swapImage('imgToSwap', 'Eyewinker.gif')" onmouseout="swapImage('imgToSwap', 'Minilogo.gif')" /></a> 

     </div> 
    </BODY> 

</HTML> 
+1

我確定需要花費大量時間來反編碼每行代碼,但請撤消該操作,並在行前使用四個空格。您也可以將代碼粘貼到問題中,將其突出顯示,然後在編輯器中按下「{}」按鈕。 – JJJ

+0

大聲笑它確實做了,我改正了嗎?感謝您的領導:) –

回答

0

如果您是新手,則應儘量避免使用冗長的JavaScript,因爲這對您來說很難管理。相反,我鼓勵你從圖像屬性開始,如onmouseoveronmouseout。請考慮以下內容:

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="UTF-8"> 
     <title>Hover-Fading Buttons</title> 
     <base href="http://parkleyvisualarts.com/" /> 
     <style> 
      img.logo { 
       width: 300px; 
       height: 300px; 
       display: block; 
       margin: 0 auto; 
      } 
     </style> 
    </head> 
    <body> 
     <img src="Minilogo.gif" class="logo" 
      onmouseover=" this.src = 'Eyewinker.gif' " 
      onmouseout=" this.src = 'Minilogo.gif' " /> 
    </body> 
</html> 
+0

不能夠感謝你!你先生,是一個非常善良的傳奇人物!爲我完全修復它!我添加了「邊框:0」,因此IE中的圖像周圍沒有框,但非常感謝!讓我的一天:) –