일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- MYSQL
- html
- SQL
- Stock
- JavaScript
- Stock ipo
- 맥
- java
- 주식 청약
- 6월 공모주 청약 일정
- codeigniter
- linux
- 리눅스
- 주식
- jquery
- Eclipse
- 주식 청약 일정
- IPO
- php
- Oracle
- 코드이그나이터
- 제이쿼리
- 공모주
- 7월 공모주 청약 일정
- 공모주 청약
- 공모주 청약 일정
- 자바
- 자바스크립트
- css
- 오라클
- Today
- Total
개발자의 끄적끄적
[javascript] location 객체 본문
[javascript] location 객체
location
location은 URL 정보를 가져오는 객체입니다. URL 전체 또는 일부의 정보를 가져올 수 있는데, 대표적인 것들은 다음과 같습니다.
- location
- location.host
- location.hostname
- location.href
- location.pathname
- location.protocol
예제
URL이
https://example.codingfactory.net/_lab/javascript.html
일 때, 각 객체 속성이 어떤 값을 가져오는지 알아보는 예제입니다.
<!doctype html> <html lang="ko"> <head> <meta charset="utf-8"> <title>JavaScript</title> <style> h1 { font-family: "Times New Roman"; font-style: italic; } </style> </head> <body> <h1>location</h1> <script> document.write( location ); </script> <h1>location.host</h1> <script> document.write( location.host ); </script> <h1>location.hostname</h1> <script> document.write( location.hostname ); </script> <h1>location.href</h1> <script> document.write( location.href ); </script> <h1>location.pathname</h1> <script> document.write( location.pathname ); </script> <h1>location.protocol</h1> <script> document.write( location.protocol ); </script> </body> </html>
'개발 > javascript & jquery' 카테고리의 다른 글
[자바스크립트] 리스트 검색 필터 (0) | 2020.07.29 |
---|---|
[vue.js] Vuex 시작하기 1 - Vuex와 State [펌] (0) | 2020.07.29 |
[jquery] datepicker label explorer 오류 (0) | 2020.07.11 |
[javascript] instagram 파싱하기 (0) | 2020.07.08 |
[javascript] alert library 유용한 alert 창 라이브러리 alert창에 url제거 [펌] (0) | 2020.07.06 |