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 | <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <a href="NewFile.html">NewFile.html로 이동</a> <br> <form action="NewFile.html"> <input type="submit" value="NewFile.html로 이동"> </form> <br> <button type="button" onclick="myfunc()">버튼</button> <br> <script type="text/javascript"> function myfunc() { //스크립트에서 페이지 이동할 때 location.href = "NewFile.html"; } </script> </body> </html> | cs |
HTML에선 action이나 <a>로 페이지를 이동
JavaScript에서도 location.href로 페이지를 이동할 수 있다.
'IT Study > Web' 카테고리의 다른 글
[JavaScript] setInterval 응용 예제 (0) | 2018.08.06 |
---|---|
[JavaScript] location 관련 함수 - back(), reload(), forward() (0) | 2018.08.06 |
[JavaScript] setInterval 기본 예제 (0) | 2018.08.06 |
[JavaScript] HTML 과 JavaScript 기본 예제 (0) | 2018.08.06 |
[JavaScript] Math 관련 예제 (0) | 2018.08.06 |