웹프로그래밍

Global It Leader!!


CSS


 
 

FF와 IE에서 사용되는 자바스크립트의 7가지 차이점

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 5,743회 작성일 11-06-01 19:23

본문


1. CSS "float" 속성
   - IE 문법
     1. document.getElementById("header").style.styleFloat = "left";  
   - FF 문법
     1. document.getElementById("header").style.cssFloat = "left";

2. Computed Style
   <div style="background-color:#red;"></div>
   이런식으로 작업할 경우
   document.getElementsByTagName('div')[0].style.backgroundColor할 경우 값을 가져 올 수 있지만
   <div id="header" class="red"></div>
   클래스를 주고 css를 정의할 경우 위와 같은 방식으로는 값을 가져 올 수 없습니다.

   해서 위의 내용과 값이 클래스명으로 값을 줬을 경우는 다음과 같이 해주셔야 합니다.
   - IE 문법
   1. var myObject = document.getElementById("header");  
   2. var myStyle = myObject.currentStyle.backgroundColor;  
   - FF 문법
   1. var myObject = document.getElementById("header");  
   2. var myComputedStyle = document.defaultView.getComputedStyle(myObject, null);  
   3. var myStyle = myComputedStyle.backgroundColor;  

3. class명을 스크립트에서 가져올때
   - IE 문법
   1. var myObject = document.getElementById("header");  
   2. var myAttribute = myObject.getAttribute("className");  
   - FF 문법
   1. var myObject = document.getElementById("header");  
   2. var myAttribute = myObject.getAttribute("class");  

4. Label 태그의 for속성을 접근할때는
   - IE 문법
   1. var myObject = document.getElementById("myLabel");  
   2. var myAttribute = myObject.getAttribute("htmlFor");  
   - FF 문법
   1. var myObject = document.getElementById("myLabel");  
   2. var myAttribute = myObject.getAttribute("for");  

5. Cursor의 포인터를 가져올때는
   - IE 문법
   1. var myCursorPosition = [0, 0];  
   2. myCursorPosition[0] = event.clientX;  
   3. myCursorPosition[1] = event.clientY;  
   - FF 문법
   1. var myCursorPosition = [0, 0];  
   2. myCursorPosition[0] = event.pageX;  
   3. myCursorPosition[1] = event.pageY;  

6. Viewport의 크기나 브라우져의 윈도우 사이즈를 가져올때
   - IE 문법
   1. var myBrowserSize = [0, 0];  
   2. myBrowserSize[0] = document.documentElement.clientWidth;  
   3. myBrowserSize[1] = document.documentElement.clientHeight;  
   - FF 문법
   1. var myBrowserSize = [0, 0];  
   2. myBrowserSize[0] = window.innerWidth;  
   3. myBrowserSize[1] = window.innerHeight;  

7. 투명 Alpha값
   - IE 문법
   1. #myElement {  
   2.     filter: alpha(opacity=50);  
   3. }  

   1. var myObject = document.getElementById("myElement");  
   2. myObject.style.filter = "alpha(opacity=80)";  

   - FF 문법
   1. #myElement {  
   2.     opacity: 0.5;  
   3. }  

   1.var myObject = document.getElementById("myElement");  
   2.myObject.style.opacity = "0.5";  

댓글목록

등록된 댓글이 없습니다.

전체 72
게시물 검색
CSS 목록
번호 제목 글쓴이 조회 날짜
72 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8359 08-21
71 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7983 11-28
70 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7728 05-12
69 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6154 09-18
열람중 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5744 06-01
67 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5694 08-22
66 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4607 05-20
65 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4467 04-17
64 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4440 02-17
63 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4418 02-17
62 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4343 02-17
61 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4207 10-11
60 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3987 08-19
59 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3947 03-08
58 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3891 02-08
57 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3887 01-21
56 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3800 09-06
55 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3696 12-23
54 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3686 05-20
53 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3570 01-21