HTML│CSS│Java Script26 html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 DOM /* 요소 선택자 */ div{background-color:skyblue;height:100px} function change_go(){ document.getElementById("mydiv").style.background="yellow"; } /*body 부분의 구조를 읽고 난 뒤에 실행하세요*/ /*페이지 로드 이벤트*/ window.onload=function(){ var btn1=document.getElementById("btn1"); btn1.onclick=function(){ document.getE.. 2017. 12. 6. html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 동일 요소 검색 : getElementsByTagName onload = function(){ document.getElementById("btn").onclick = function(){ var count = document.getElementsByTagName("li"); //alert(count.length);//10 var s =""; for (var i = 0; i 2017. 12. 6. html 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Number Methods //Nan : 숫자가 들어갈 자리에 숫자가 아닌 다른 값이 들어오면 표시 //isNan : Nan 확인 //Number() : 숫자형 문자를 숫자로 바꾼다. 잘못 들어오면 Nan표시 //parseInt : 정수 변환 //parseFloat : 실수 변환 document.write(Number("10")+" ");//10 document.write(Number("10.33")+" ");//10.33 document.write(Number("10 20 30")+" ");//Nan document.write(Number("10 years").. 2017. 12. 6. html 예제 html 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 Insert title here document.write(" Math Method "); document.write("2의 10승 : "+Math.pow(2,10)+" "); document.write("3,25,9,47,2,5,7 중 가장 큰 수 : "+Math.max(.. 2017. 12. 6. p 태그 id에 자바스크립트 결과 담기 p 태그 id에 자바스크립트 결과 담기 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 Insert title here //객체 생성 var person=new Object(); person["name"]="최은서"; person["age"]="20"; person["salary"]=3200; document.write(person["name"]+" "); document.write(person.age+" "); document.write(person.salar.. 2017. 12. 6. 이전 1 2 3 4 5 6 다음