웹프로그래밍

Global It Leader!!


CSS


 
 

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

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 5,758회 작성일 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 목록
번호 제목 글쓴이 조회 날짜
12 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3998 08-19
11 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3959 03-08
10 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3906 02-08
9 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4480 04-17
8 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4450 02-17
7 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4429 02-17
6 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4354 02-17
5 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6165 09-18
4 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5705 08-22
3 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8377 08-21
열람중 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5759 06-01
1 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7739 05-12