• 회원가입
  • 로그인
  • 구글아이디로 로그인

[DOM_Document] JS - document.URL 속성 - 웹문서주소 (= document.URL속성 = 다큐먼트유알엘속성/도큐먼트유알엘속성)

목차
  1. document.URL 예제 - 웹문서 URL 주소 반환
  2. document.URL 정의
  3. document.URL 구문
  4. document.URL 예제 - 웹문서 URL 주소 출력

 

document.URL 예제 - 웹문서 URL 주소 반환 

 

<button onclick="homzzang()">클릭</button>

 

<p id="demo"></p>

 

<script>

function homzzang() {

  var x = document.URL;

  document.getElementById("demo").innerHTML = x;

}

</script>

 

결과보기

 

document.URL 정의

 

웹문서 URL 주소 반환.

 


 

1. cf.

window.location.href (= 또는, location.href)

 

2.

IE9 이상 주요 최신 브라우저 모두 지원.

 

3. MDN document.URL 매뉴얼

https://developer.mozilla.org/en-US/docs/Web/API/Document/URL

 

 

document.URL 구문

 

document.URL

 


[반환값]

 

프로토콜 (예: https://) 포함한 웹문서의 전체 URL 주소 반환. (※ string 타입)

 

 

document.URL 예제 - 웹문서 URL 주소 출력

 

<p id="demo"></p>


<script>

let url = document.URL;

document.getElementById("demo").innerHTML = url;

// 결과값 예: http://localhost/

</script>

 

 

방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

분류 제목
DOM_Event JS - toggle 이벤트 (= ontoggle 속성) - <details> 요소 (열기/닫기) 시 발생 …
DOM_Event JS - touchcancel -
DOM_Event JS - touchend 이벤트 (= ontouchend 속성) - 손가락 뗄 때 이벤트 발생 (= 터치이벤…
DOM_Event JS - touchmove -
DOM_Event JS - touchstart 이벤트 - 사용자가 요소를 터치할 때 실행 (= touchstart이벤트 = 터…
DOM_Event JS - transitionend -
DOM_Event JS - unload 이벤트 (= onunload 속성) - 사용자가 웹문서 닫을때 JS실행 (= 언로드 이…
DOM_Event JS - volumechange -
DOM_Event JS - waiting -
DOM_Event JS - wheel 이벤트 (= onwheel속성) ★ - 마우스휠 스크롤 이벤트
DOM_Event JS - AltKey -
DOM_Event JS - altKey -
DOM_Event JS - animationName -
DOM_Event JS - bubbles 속성 - 이벤트확산여부판별 (= 확산이벤트판별 = 버블즈속성, IE9)
DOM_Event JS - button -
DOM_Event JS - buttons -
DOM_Event JS - cancelable -
DOM_Event JS - charCode -
DOM_Event JS - changeTouches -
DOM_Event JS - clientX 속성 - 현재창 기준 마우스커서 수평 좌표 위치 (= clientX속성 = 클라이언트…
35/67
목록
찾아주셔서 감사합니다. Since 2012