Programming/JavaScript

table 에 링크걸기 tr,td..

Edward. K 2007. 6. 22. 19:21
반응형

<tr>이나 <td> 어디에나 가능합니다. ^^


링크 걸기


<table style="cursor:hand;" onclick="location.href='URL'">내용</table>


style="cursor:hand;" -> 마우스 오버시 커서를 손모양으로 보여줌

onclick="location.href='URL'" -> URL에 링크주소를 넣어주시면 테이블에 링크 걸림


-- 해당 페이지

<td height="248" style="cursor:hand;" onclick="location.href='http://www.kpresort.com/'"></td>

-- 새창에서 열기
     : 음.. target=_self지정을 하는 방법을 몰라서..다음의 방법으로 처리 했다..-_-;

<td height="248" style="cursor:hand;" onclick="window.open('http://www.kpresort.com/','resort','scrollbars=yes location=yes menubar=yes toolbar=yes resizable=yes width=800 height=600')">

타겟 지정하기

onclick="location.href='URL'" 이 부분을 아래와 같이 바꿔주세요.

onclick="parent.frames[타겟프레임번호].location='URL'"


프레임에서 타겟 프레임번호 주는 법.


<frameset >
<frame src="*.html" name="menu"> 0
<frame src="*.html" name="main"> 1
<frame src="*.html" name="bottom"> 2
</frameset>

위와 같이 첫번째 프레임은 0, 두번째는 1, 세번째는 2 ...

만약 네번째가 있다면 3 이런식으로 번호를 주면 된다.


만약 name="main"의 내용이 바뀌길 원한다면..

onclick="parent.frames[1].location='URL'"

한번 클릭으로 main과 bottom 이런식으로 여러개의 타겟이 바뀌길 원한다면..

onclick="parent.frames[1].location='URL'; parent.frames[2].location='URL'"

이렇게 바꿔주시면 됩니다.

반응형