달력

082010  이전 다음

  • 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
  •  
  •  
  •  
  •  
location 객체 .........................................................

window객체에서 파생된 것으로 window를 생략한다.
현재 열려있는 문서의 URL정보를 얻을 수 있고...

이보다는 앞으로 이동할 문서의 URL을 설정하는 데 아주 중요하게 사용됩니다!!!


■ location 객체 프로퍼티
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:
searchURL 조회부분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="location.reload()"> 새로고침 </a>

<script language="javascript">
// 연 창의 URL 새로 고침
opener.location.reload()
</script>

Posted by 상현넘™

댓글을 달아 주세요