Jsp
Jsp - 버튼제어
프리덕
2020. 6. 16. 11:22
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<!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.document.forms[0].변수 -> action, method, name,....
// document.폼이름.변수
// document.fr.action
// document.fr.method
// document.fr.name
// window.document.forms[0].함수() submit() reset()
// window.document.폼이름.함수()
// document.fr.submit()
// document.fr.reset()
function fun1() {
alert(document.fr.action);
alert(document.fr.method);
alert(document.fr.name);
}
function fun2() {
document.fr.submit();
}
function fun3() {
document.fr.action="b.jsp";
document.fr.method="post";
document.fr.submit();
}
function fun4(x) {
if(x=='barsket'){
document.fr.action="a.jsp";
document.fr.submit();
}
else{
document.fr.action="b.jsp";
document.fr.submit();
}
}
</script>
</head>
<body>
<h1>js3/test2.html</h1>
<form action="a.jsp" method="get" name="fr">
<input type="text" name="id"><br>
<input type="button" value="버튼" onclick="fun1()">
<input type="button" value="전송버튼" onclick="fun2()">
<input type="button" value="변경&전송" onclick="fun3()">
<input type="button" value="장바구니" onclick="fun4('barsket')">
<input type="button" value="바로구매" onclick="fun4('order')">
</form>
</body>
</html>
|
cs |
설정해 놓은데로 이리저리 왔다 갔다 잘 실행이 되니까 참 뿌듯하다.