Jsp - 주소확인

2020. 6. 16. 10:46Jsp

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
//    웹브라우저 내장객체
//    window(창) - location(주소록)
//                    - history(방문기록)
//                    - document(html문서) ->image,link,layer...
//                                                                - form(로그인창)->text,password,textarea
//                                                                -checkbox, radio
//                                                                -select - option
// window생략가능
// window.location.변수                location.href  - 주소줄안의 주소를 저장하는 변수
// window.location.함수()            location.reload() - 새로고침
 
function fun1() {
//     var a="주소";
//     alert(a);
// 주소줄에 있는 주소를 href변수에 미리 저장되있음
alert(location.href);
}
function fun2() {
    //자바스크립트 하이퍼링크 페이지 이동
alert("test1.html로 이동");
    location.href="http://localhost:8080/Study_JSP/js2/test1.html"
}
function fun3() {
    location.reload();
}
function fun4() {
    alert(location.href);
alert(location.protocol);//http
alert(location.hostname);//localhost
alert(location.host);//localhost:8080
alert(location.port);//8080
}
</script>
</head>
<body>
<h1>js2/test2.html</h1>
<input type="button" value="주소확인" onclick="fun1()">
<input type="button" value="주소변경" onclick="fun2()">
<input type="button" value="새로고침" onclick="fun3()">
<input type="button" value="주소정보" onclick="fun4()">
 
</body>
</html>
cs

 

 

 

'Jsp' 카테고리의 다른 글

Jsp - 화면 색 변경  (0) 2020.06.16
Jsp - 페이지 이동  (0) 2020.06.16
Jsp - 창열기,닫기  (0) 2020.06.16
Jsp - 화면4  (0) 2020.06.16
Jsp - 화면3  (0) 2020.06.16