/*
DOM 스크립트
*/
document.createElement("p")
document.createTextNode("")
node.cloneNode(false)
node.nodeType()
node.nodeValue()
document.getElementById("description").firstChild.nodeValue
attribute node="description" 인 요소노드의 firstChild 는 textNode 이다.
document.getElementById(element node)
document.getElementsByTagName(element node)
<> document.createTextNode("Hello world")
document.body.appendChild(para)
document.removeChild(message)
element.insertBefore(newNode, targetNode)
element.replaceChild(newChild, oldChild)
element.setAttribute(attributeName, attributeValue) - element 요소만 가능
element.setAttribute(attribute, Value )
node.hasChildNodes()
node.childNodes.length
document.childNodes[0].nodeName == "HTML"
node.lastChild == node.childNodes[element.childNodes.length - 1]
document.body.appendChild(placeholder);
document.body.appendChild(description);
var gallery = document.getElementById("imagegallery");
gallery.parentNode.insertBefore(placehorder, gallery);
addLoadEvent();
addLoadEvent();
insertAfter() {}
/*
HTML DOM
*/
document.getElementByTagName("title").firstChild.nodeValue;
var w = window.open();
w.document.open();
w.document.write
w.document.close();
//write() 글이 쓰여진 새창을 띄운후 close한다
document.getElementById("w3c").taget = "_blank";
// 새창 띄우기.
// target
<area id="venus" shape="circle"
coords="124,58,8"
alt="Venus"
href="venus.htm?id=venus" />
document.getElementById("venus").host == "www.w3scholls.com"
getElementById("venus").hostname
getElementById("venus").pathName == "/jsref/venus.html"
getElementById("venus").search == "?id=venus"
getElementById("venus").shape == "circle"
document.getElementById("button1").form.id
document.getElementById("button1").parentNode.getAttribute("id")
<form id="frm1" accept-charset="ISO-8859-1">
document.getElementById("frm1").acceptCharset == "ISO-8859-1"
/*
document.getElementById("frm1").length
if(!document.getElementById) return false;
if(!document.getElementByTagName) return false;
if(!document.getElementByid("frm1")) return false;
var frm = document.getElementById("frm1");
var tagFrm = frm.getElementByTagName.childNodes;
for(var i=0; i<tagFrm.length; i++){
if(!tagFrm[i]) return false;
document.write( tagFrm[i] );
}
*/
<iframe id="myframe" src="/default.asp">
document.getElementById("myframe").align="right";
// 글 오른쪽에 iframe이 위치함
<form onmousedown="whichButton(event)">
if( event.button == 2) { alert("you clicked the right mouse button!"); }
else { alert("you clicked the left mouse button!"); }
'Client Standard > JavaScript & jQuery' 카테고리의 다른 글
select box Option 속성 클릭 시 나타나는 Behavior (0) | 2012.07.22 |
---|---|
jQuery select box node 접근방법 (0) | 2012.07.20 |
태그 id와 name이 js function() 이름과 같으면 나는 에러 (0) | 2012.07.20 |
getCookie() (0) | 2012.07.20 |
jQuery selectbox (0) | 2012.07.20 |