HTML/예제

<button>태그 링크

앙큼한유채 2017. 3. 22. 13:38

1. <button>태그에 링크거는 방법


-1) 현재창에 띄우는 방법

<button type="button" onclick="location.href='url' ">버튼내용</button>

<input type="button" name="button" value="내용" onclick="location.href='url'">


-2) 새창에서 띄우는 방법

<button type="button" onclick="window.open('url')">버튼내용</button>

<input type="button" name="button" value="버튼내용" onclick="window.open('url')">


-3) 팝업창에서 띄우는 방법

<button type="button" onclick="window.open('url','win','width=500,height=500,toolbar=0,scrollbars=0,resizable=0')">버튼내용</button>

<input type="button" name="button" value="버튼내용" onclick="window.open('url','win','width=500,height=500,toolbar=0,scrollbars=0,resizable=0')">


-4) 프레임에 출력하는 방법

 <button type="button" onclick="parent.프레임명.location‎.href='url'";>버튼내용</button>

<input type="button" name="button" value="버튼내용" onclick="parent.프레임명.location‎.href='url'";>