웹프로그래밍

Global It Leader!!


HTML/CSS


 
 

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

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 6,186회 작성일 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";  

[이 게시물은 운영자님에 의해 2025-12-20 22:17:11 CSS에서 이동 됨]

댓글목록

등록된 댓글이 없습니다.

전체 48
게시물 검색
HTML/CSS 목록
번호 제목 글쓴이 조회 날짜
열람중 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6187 06-01
47 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8236 05-12
46 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5017 05-20
45 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4119 05-20
44 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3609 05-14
43 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3752 04-27
42 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3666 02-04
41 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4235 09-06
40 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3933 01-28
39 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4383 01-21
38 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4025 01-21
37 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4137 12-23
36 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4441 08-19
35 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4383 03-08
34 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4299 02-08
33 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4912 04-17
32 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4832 02-17
31 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4816 02-17
30 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4736 02-17
29 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6562 09-18