본문 바로가기
○ WEB/19.03 FastCampus_CSS

input, button 태그의 외부, 내부링크 걸기 / href / onClick

by 0ver-grow 2019. 7. 26.
반응형

버튼 태그에 링크거는 방법!

 

input type = "button" / button type = "button"


현재탭 <input type="button" value="버튼" onClick="location.href='입력'">

새탭 <input type="button" value="버튼" onClick="window.open('입력')">

예시 )

외부링크

<input type="button" value="버튼" onClick="location.href='http://www.stackoverflow.com'>

<input type="button" value="버튼" onClick="location.href='index.html'>

 

내부링크

<input type="button" value="버튼" onClick="location.href='#name1'>

<a id="name1"> 클릭1 </a>

<input type="button" value="버튼" onClick="location.href='#name2'>

<a name="name2"> 클릭2 </a>


 

 

 

 

반응형