Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2007-09-16 13:06:30
Size: 302
Editor: 218
Comment:
Revision 6 as of 2008-03-23 11:06:06
Size: 2234
Editor: 218
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

http://domscripting.com
Line 8: Line 10:
== 주요내용 ==
Node (nodeType)
 1. element (1)
 1. attribute (2)
 1. text (3)

꼭 알아야할 핵심 기본기
 1. 단계적 기능 축소 (Graceful degration) : 스크립트를 사용하지 않더라도 동작 가능한 웹문서 만들기
 1. 스크립트 분리 (Unobtrusive JavaScript) : 웹 문서 구조에서 동작 분리하기
 1. 하위 호환성 (Backwards compatibility) : 구 웹 브라우저에서도 동작 가능하도록 확인하기

위 내용을 준수한 팝업 윈도우 스크립트 (a tag에 class="popup"을 적은 후)

{{{#!java
function popUp(winURL) {
    window.open(winURL, 'Pop-up window', 'width=320, height=480');
    return false;
}

window.onload = function() {
    if (!document.getElementsByTagName) return false;
    var links = document.getElementsByTagName('a');
    for (var i=0; i<links.length; i++) {
        if (links[i].className == "popup") {
            links[i].onclick = function() {
                return popUp(this.getAttribute('href'));
            }
        }
    }
}}}

[DOM] core and HTML-DOM
{{{
document.getElementsByTagName("form")
document.forms

element.getAttribute("src")
element.src

element.setAttribute("src", a)
element.src = a
}}}

노드 메쏘드들
 * getElementById
 * getElementsByTagName
 * getAttribute
 * setAttribute
 * createElement
 * appendChild
 * createTextNode
 * insertBefore (ex, parentElement.insertBefore(newElement, targetElement) )

노드 속성들
 * nodeValue
 * firstChild
 * lastChild
 * parentNode
 * nextSibling

직접 구현하는 insertAfter
{{{#!java
function insertAfter(newElement, targetElement) {
    var parent = targetElement.parentNode;
    if (parent.lastChild == targetElement) {
        parent.appendChild(newElement);
    } else {
        parent.insertBefore(newElement, targetElement.nextSibling);
    }
}
}}}

ISBN(1590595335)

ISBN(8960770035,N)

http://domscripting.com

[DOM] Scripting. JeremyKeith 저서, 부제 WebDesign with JavaScript and the [DOM], 번역판 제목 DOM 스크립트

관련포스트

주요내용

Node (nodeType)

  1. element (1)
  2. attribute (2)
  3. text (3)

꼭 알아야할 핵심 기본기

  1. 단계적 기능 축소 (Graceful degration) : 스크립트를 사용하지 않더라도 동작 가능한 웹문서 만들기
  2. 스크립트 분리 (Unobtrusive JavaScript) : 웹 문서 구조에서 동작 분리하기

  3. 하위 호환성 (Backwards compatibility) : 구 웹 브라우저에서도 동작 가능하도록 확인하기

위 내용을 준수한 팝업 윈도우 스크립트 (a tag에 class="popup"을 적은 후)

   1 function popUp(winURL) {
   2     window.open(winURL, 'Pop-up window', 'width=320, height=480');
   3     return false;
   4 } 
   5 
   6 window.onload = function() {
   7     if (!document.getElementsByTagName) return false;
   8     var links = document.getElementsByTagName('a');
   9     for (var i=0; i<links.length; i++) {
  10         if (links[i].className == "popup") {
  11             links[i].onclick = function() {
  12                 return popUp(this.getAttribute('href'));
  13             }
  14         }    
  15     }

[DOM] core and HTML-DOM

document.getElementsByTagName("form")
document.forms

element.getAttribute("src")
element.src

element.setAttribute("src", a)
element.src = a

노드 메쏘드들

  • getElementById
  • getElementsByTagName
  • getAttribute
  • setAttribute
  • createElement
  • appendChild
  • createTextNode
  • insertBefore (ex, parentElement.insertBefore(newElement, targetElement) )

노드 속성들

  • nodeValue
  • firstChild
  • lastChild
  • parentNode
  • nextSibling

직접 구현하는 insertAfter

   1 function insertAfter(newElement, targetElement) {
   2     var parent = targetElement.parentNode;
   3     if (parent.lastChild == targetElement) {
   4         parent.appendChild(newElement);
   5     } else {
   6         parent.insertBefore(newElement, targetElement.nextSibling);
   7     }
   8 }


CategoryBookComputer

DomScripting (last edited 2013-08-13 23:50:32 by 220)

web biohackers.net