2013-07-30 5 views
0

감사합니다."IE가 작동하지 않는 경우"

나는 해결할 수없는 간단한 문제가 있습니다. Jquery fadeIn 및 fadeOut 효과가있는 html지도가 필요합니다. 나는 그것을 가지고 IE8을 제외한 모든 곳에서 작동합니다.

그래서 저는 단지 이미 테스트되었고 IE8이 존재할 때만 작동하는 순수한 자바 스크립트를 추가하고 싶습니다.

분명히이 코드를 작성했지만 Internet Explorer 주석 뒤에 간단한 경고로도 작동하지 않습니다.

도와 주시겠습니까?

다음은 코드입니다. 감사합니다.

<script type="text/javascript">var runFancy = true;</script> 
      <!--[if IE]> 
      <script type="text/javascript"> 
       runFancy = false; 
       alert(runFancy); 
       function showIt(name) 
       { 

       document.getElementById('map_image').src='immagini/distributori/8/'.concat(name).concat('.png'); 
       document.getElementById('map_image').style.display='block'; 


       } 

       function hideIt() 
       { 

       document.getElementById('map_image').src='immagini/distributori/8/map.png'; 

       }; 

      </script> 
      <![endif]--> 

여기에서도이 어떤 조언을 작동하지 않는 다른 브라우저

  <!--[if !IE]><!--> 
      <script type="text/javascript"> 
      //alert('hi'); not working even just this 
       if (runFancy) { 
        function showIt(name) 
       { 


       document.getElementById('map_image').src='immagini/distributori/single/'.concat(name).concat('_single.png'); 


       $('#mapon').fadeIn(400); 



       } 

       function hideIt() 
       { 

       $('#mapon').fadeOut(300); 
       }; 
       } 
      </script> 
      <!--<![endif]--> 

의 코드는?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title>Untitled Document</title> 
</head> 

<body style="background-color:red"> 

<h1>Ciao</h1> 


<!--[if IE]> 
<style language="text/css"> 
body{background-color:black;} 

</style> 
<![endif]--> 
</body> 
</html> 

모든 IE 버전에서 작동하지 않습니다.

+0

이 나에게 맞는 것 같습니다. !!!! –

+0

나도 쓰기는하지만 너무 일하는 사람이지만 작동하지 않는다. – SBO

+0

SBO

답변

0

당신이 가지고있는 코드가 작동하지만 그냥 IE 8을 대상으로 할 경우 너무

<!--[if IE 8]> 
do stuff 
<![endif]--> 

편집과 같은 IE 8 대신의 IE를 넣어해야합니다 감가 상각 제거 JQuery와 솔루션

+1

jQuery 브라우저가 1.9에서 제거되어 이전 버전의 jQuery에서만 작동합니다. – putvande

+0

내 문제가 jquery에 없다면 다음과 같은 간단한 코드를 만들었습니다. 제목 없음 문서 <바디 스타일 ="배경 색 : 빨간색 ">

챠오

SBO

1

을이 당신을 도울 것입니다 :

HTML :

<!doctype html> 
<!--[if IE]><![endif]--> 
<!--[if lt IE 7 ]> <html lang="en" class="ie6"> <![endif]--> 
<!--[if IE 8 ]> <html lang="en" class="ie8"> <![endif]--> 
<!--[if IE 9 ]> <html lang="en" class="ie9"> <![endif]--> 
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]--> 
    <head></head> 
    <body></body> 
</html> 

자바 스크립트 :

<!--[if IE 8]> 
<script type="text/javascript" src="IE8.js"> 
<![endif]--> 
+1

는 :(작동하지 헤더 나 본문에 다음과 같이 입력하십시오. ie8 및 ie10과 함께 아무 일도 일어나지 않습니다! – SBO