목록웹 프로그래밍/Javascript (15)
코딩하는 문과생
11. 값 받기(forms[]) form 태그 내의 input 태그를 배열의 형식으로 받는다. 1234567891011121314151617181920212223 First name: Last name: Try function myFunction(){ var x = document.getElementById("frm1"); //frm1에 해당하는 값들 배열형식으로 가져오기 var text=""; var i; for(i=0;i
자바스크립트/ 10. querySelectorAll querySelectorAll은 들어오는 지정된 요소 값에 해당하는 값들을 변수 x에 할당한다. 1234567891011121314 Hello World! The DOM is very useful. This example demonstrates. var x = document.querySelectorAll("p.intro"); //p.intro에 해당하는 값을 x에 저장한다. document.getElementById("demo").innerHTML = x[0].innerHTML;Colored by Color Scriptercs
09. location 객체와 history 객체 -location 객체 href: 현재페이지의 href(URL)반환hostname: 웹호스트의 도메인 이름을 반환pathname: 현재 페이지의 경로와 파일 이름을 반환protocol: 사용된 웹 프로토콜을 반환 1234567891011 document.getElementById("demo").innerHTML = "page location is: " + window.location.href + " " + "page hostname is: " + window.location.hostname + " " + "page path is: " + window.location.pathname + " " + "page protocol is: " + window.loc..
08. window 객체 중요한 메서드 -open(), close() open 메서드는 window.open(URL, name, specs, replace); 로 사용되고close 메서드는 window.close(); 로 사용된다. 1234567Open "myWindow" function openWin(){ window.open("http://www.google.com", "_blank", "toolbar=yes, scrollbars=yes, resizable=yes,top=500,left=500,width=400,height=400"); }Colored by Color Scriptercs -setTimeout()밀리 초 후에 함수가 실행된다. 123456Try function myFunction(){ ..