메뉴 건너뛰기

2021.03.25 14:38

오브젝트 속성

조회 수 237 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
t type="text/javascript">
var obj= document.getElementById("object");
 for(var x in obj)
{
	//aaa;
   document.write("<B>"+ x + "</B>" + " : ", [obj[x]] + "<br />");
}
</script>

위의 소스에서 "object" 부분에 자신이 알고 싶은 오브젝트의 id 값을 넣고 실행시켜 보면, 해당 오브젝트의 모든 값이 나온다. 한 오브젝트에 이렇게 많은 속성들이 있는줄은 몰랐다..

<input type="text" name="aaa" id="aaa" />
<script type="text/javascript">
var obj= document.getElementById("aaa");
 for(var x in obj)
{
   document.write("<B>"+ x + "</B>" + " : ", [obj[x]] + "<br />");
}
</script>

위와 같이 하고 실험을 하면...
아래와 같이 나온다.. 길다.....ㅡ/.ㅡ;

 
nextSibling : [object]
onresizeend : 
onrowenter : 
aria-haspopup : 
childNodes : [object]
ondragleave : 
canHaveHTML : false
onbeforepaste : 
ondragover : 
onbeforecopy : 
aria-disabled : 
onpage : 
recordNumber : 
previousSibling : 
nodeName : INPUT
onbeforeactivate : 
accessKey : 
currentStyle : [object]
scrollLeft : 0
onbeforeeditfocus : 
oncontrolselect : 
aria-hidden : 
onblur : 
hideFocus : false
clientHeight : 18
style : [object]
onbeforedeactivate : 
dir : 
aria-expanded : 
onkeydown : 
nodeType : 1
ondragstart : 
onscroll : 
onpropertychange : 
ondragenter : 
id : aaa
aria-level : 0
onrowsinserted : 
scopeName : HTML
lang : 
onmouseup : 
aria-busy : 
oncontextmenu : 
language : 
scrollTop : 0
offsetWidth : 155
onbeforeupdate : 
onreadystatechange : 
onmouseenter : 
filters : [object]
onresize : 
isContentEditable : true
aria-checked : 
aria-readonly : 
oncopy : 
onselectstart : 
scrollHeight : 18
onmove : 
ondragend : 
onrowexit : 
lastChild : 
aria-secret : 
onactivate : 
canHaveChildren : false
onfocus : 
onfocusin : 
isMultiLine : false
onmouseover : 
offsetTop : 16
oncut : 
parentNode : [object]
tagName : INPUT
className : 
onmousemove : 
title : 
role : 
behaviorUrns : [object]
onfocusout : 
onfilterchange : 
disabled : false
parentTextEdit : [object]
ownerDocument : [object]
offsetParent : [object]
aria-posinset : 0
ondrop : 
ondblclick : 
onrowsdelete : 
tabIndex : 0
onkeypress : 
aria-relevant : 
onlosecapture : 
innerText : 
aria-live : 
parentElement : [object]
ondeactivate : 
aria-labelledby : 
aria-pressed : 
children : [object]
ondatasetchanged : 
ondataavailable : 
aria-invalid : 
onafterupdate : 
nodeValue : 
onmousewheel : 
onkeyup : 
readyState : complete
onmovestart : 
aria-valuenow : 
aria-selected : 
onmouseout : 
aria-owns : 
aria-valuemax : 
onmoveend : 
contentEditable : inherit
document : [object]
firstChild : 
sourceIndex : 5
outerText : 
isTextEdit : true
isDisabled : false
oncellchange : 
runtimeStyle : [object]
scrollWidth : 151
aria-valuemin : 
onlayoutcomplete : 
onhelp : 
attributes : [object]
offsetHeight : 22
onerrorupdate : 
onmousedown : 
clientTop : 2
aria-setsize : 0
clientWidth : 151
onpaste : 
tagUrn : 
onmouseleave : 
onclick : 
outerHTML : <input id="aaa" name="aaa" />
ondrag : 
aria-controls : 
onresizestart : 
aria-flowto : 
ondatasetcomplete : 
aria-required : 
clientLeft : 2
aria-describedby : 
all : [object]
onbeforecut : 
innerHTML : 
aria-activedescendant : 
aria-multiselectable : 
offsetLeft : 10
onchange : 
border : 
lowsrc : 
value : 
status : false
readOnly : false
hspace : 0
dataSrc : 
alt : 
maxLength : 2147483647
vspace : 0
dataFld : 
onerror : 
align : 
loop : 1
onabort : 
src : 
complete : false
width : 0
form : 
start : fileopen
vrml : 
accept : 
dynsrc : 
dataFormatAs : 
onload : 
size : 20
indeterminate : false
checked : false
height : 0
defaultChecked : false
type : text
name : aaa
onselect : 
useMap :  

언젠가.. 해당 오브젝트가 가지고 있는 어떤 값을 알고 싶은데 알수가 없어서 찾아보다가 알아낸 것..

//----------추가사항 2014.5.15

<script type="text/javascript">
var obj= document.getElementById("aaa");
 for(var x in obj)
{
   document.write("<B>x__"+ x + "</B>" + " : ", [obj[x]] + "<br>");
   for(var y in obj[x]) document.write("<B>y__"+ y + "</B>" + " : ", [obj[x][y]] + "<br>");
   document.write("___________________<br><br><br>");
}
</script>

  1. opener 값전달, 함수실행.(자식창에서 부모창으로 값전달, 함수실행)

    Date2021.03.26 Views1437
    Read More
  2. getYear(); 크롬, 파이어폭스 에서 제대로 작동 안하는 문제

    Date2021.03.26 Views197
    Read More
  3. DTREE 트리구조 만들기

    Date2021.03.26 Views862
    Read More
  4. 페이지 이동

    Date2021.03.26 Views190
    Read More
  5. default 매개변수(매개변수 기본값)

    Date2021.03.26 Views199
    Read More
  6. 자바스크립트에서 이벤트 중단 하는 방법

    Date2021.03.25 Views321
    Read More
  7. 현재 날짜, 시간 ( Month + 1 에 대해서 )

    Date2021.03.25 Views218
    Read More
  8. 오브젝트 속성

    Date2021.03.25 Views237
    Read More
  9. jqgrid 이용한 그리드 활용하기

    Date2021.03.25 Views2325
    Read More
  10. HTML, Javscript - 선택한 색상으로 배경색 바꾸기(pallet 만들기)

    Date2021.03.09 Views712
    Read More
  11. Javascript - 입력받은 숫자를 순서대로 홀짝 별로 배열에 삽입하기

    Date2021.03.09 Views302
    Read More
  12. Javascript - Free SVG 한국맵 제어 처리

    Date2021.03.09 Views870
    Read More
  13. Javascript - form태그 내부 ajax처리시 2번 전송되는 현상

    Date2021.03.09 Views268
    Read More
  14. javascript - vanillaJS로 체크박스(checkbox) 제어하기

    Date2021.03.09 Views498
    Read More
  15. Javascript - 유효성 체크(이메일 정규식, IP 정규식, 비밀번호 등)

    Date2021.03.09 Views726
    Read More
  16. Javascript - 사업자 등록번호 유효성 체크

    Date2021.03.09 Views1089
    Read More
  17. Javascript - Calendar 달력 생성하고 제어하기

    Date2021.03.09 Views513
    Read More
  18. Javascript - 입력한 년, 월의 마지막 날짜 구하기

    Date2021.03.09 Views224
    Read More
  19. Javascript - 화면 캡처 후 서버에 저장하기(html2canvas 사용법, 주의사항)

    Date2021.03.09 Views2164
    Read More
  20. Javascript - 이미지 미리보기 회전되어 나옴(EXIF)

    Date2021.03.09 Views36273
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved