■ location 객체 프로퍼티
아래 URL 샘플을 가지고 URL에 대한 이해를 하시길...
http://www.dragoneye.co.kr:80/column2/list.asp#top?table=table30&page=2
href 문서의 URL 주소 위 주소 전체
host 호스트 이름과 포트 http://www.dragoneye.co.kr:80
hostname 호스트 컴퓨터이름 http://www.dragoneye.co.kr
hash 앵커이름 #top
pathname 디렉토리 이하 경로 /column2/list.asp
port 포트번호 부분 80
protocol 프로토콜 종류 http:
search URL 조회부분 table=table30&page=2
■ location 객체 메서드
eval() 문자열을 숫자로 바꿈
toString() 오브젝트를 문자열로 바꿈
reload() 현재 문서를 다시 읽어옴
replace() 현재 문서를 다른 URL 문서로 바꿈
valueOf() 오브젝트 값을 표시
toSource() 오브젝트 값을 문자열로 표시
■ 열릴 문서의 URL설정하기
<script language="javascript">
// URL을 이동시킴
location.href= ";http://www.dragoneye.co.kr"
//location.href= "login.html"
</script>
--------------------------------------------------------------------------------
<script language="javascript">
alert("회원가입을 하시겠습니까?")
location.href= "member.html"
</script>
--------------------------------------------------------------------------------
<script language="javascript">
// 연 창의 URL 이동
opener.location.href= "member.html"
</script>
--------------------------------------------------------------------------------
<script language="javascript">
// 부모창 지정프레임의 URL 이동
parent .frame1.location.href= "member.html"
</script>
--------------------------------------------------------------------------------
<script language="javascript">
// 전체창에 새 페이지 열기
top.location.href= "index.html"
</script>
--------------------------------------------------------------------------------
■ 문서 새로 열기
<a href="javascript:location.reload()"> 새로열기 </a>
--------------------------------------------------------------------------------
<script language="javascript">
// 연 창의 URL 새로 열기
opener.location.reload()
</script>
■ location.href 와 location.replace 의 차이점
location.href="next.html";
히스토리가 남는다.
브라우저의 이전버튼이 활성화 된다.
location.replace="next.html";
히스토리가 남지 않는다.
브라우저의 이전버튼이 활성화 되지 않는다.
아래 URL 샘플을 가지고 URL에 대한 이해를 하시길...
http://www.dragoneye.co.kr:80/column2/list.asp#top?table=table30&page=2
href 문서의 URL 주소 위 주소 전체
host 호스트 이름과 포트 http://www.dragoneye.co.kr:80
hostname 호스트 컴퓨터이름 http://www.dragoneye.co.kr
hash 앵커이름 #top
pathname 디렉토리 이하 경로 /column2/list.asp
port 포트번호 부분 80
protocol 프로토콜 종류 http:
search URL 조회부분 table=table30&page=2
■ location 객체 메서드
eval() 문자열을 숫자로 바꿈
toString() 오브젝트를 문자열로 바꿈
reload() 현재 문서를 다시 읽어옴
replace() 현재 문서를 다른 URL 문서로 바꿈
valueOf() 오브젝트 값을 표시
toSource() 오브젝트 값을 문자열로 표시
■ 열릴 문서의 URL설정하기
<script language="javascript">
// URL을 이동시킴
location.href= ";http://www.dragoneye.co.kr"
//location.href= "login.html"
</script>
--------------------------------------------------------------------------------
<script language="javascript">
alert("회원가입을 하시겠습니까?")
location.href= "member.html"
</script>
--------------------------------------------------------------------------------
<script language="javascript">
// 연 창의 URL 이동
opener.location.href= "member.html"
</script>
--------------------------------------------------------------------------------
<script language="javascript">
// 부모창 지정프레임의 URL 이동
parent .frame1.location.href= "member.html"
</script>
--------------------------------------------------------------------------------
<script language="javascript">
// 전체창에 새 페이지 열기
top.location.href= "index.html"
</script>
--------------------------------------------------------------------------------
■ 문서 새로 열기
<a href="javascript:location.reload()"> 새로열기 </a>
--------------------------------------------------------------------------------
<script language="javascript">
// 연 창의 URL 새로 열기
opener.location.reload()
</script>
■ location.href 와 location.replace 의 차이점
location.href="next.html";
히스토리가 남는다.
브라우저의 이전버튼이 활성화 된다.
location.replace="next.html";
히스토리가 남지 않는다.
브라우저의 이전버튼이 활성화 되지 않는다.
'Flash&Action' 카테고리의 다른 글
Flex 단축키 (0) | 2010.10.20 |
---|---|
외부 텍스트 파일을 로드할때 특수문자가 깨지는 것을 방지하기 특수문자 (0) | 2010.10.20 |
Flash note (0) | 2010.10.20 |
메쏘드 모음 (0) | 2010.10.20 |
3D 메뉴 만들기 (0) | 2010.10.20 |