송신측 소스
<html>
<head>
<script language="javascript" type="text/javascript">
function checkAll(checkList, boolCheck) {
varchkSize = 0;
checkedCount = checkList.length;
if (typeof (checkedCount) != "undefined") {
for ( var i = 0; i < chkSize; i++) {
checkList[i].checked = boolCheck;
}
}
}
function checkDel() {
var chkFirList = document.getElementsByName('check');
var arrFir = new Array();
var cnt = 0;
for ( var idx = chkFirList.length - 1; 0 <= idx; idx--) {
if (chkFirList[idx].checked) {
arrFir[cnt] = chkFirList[idx].value;
cnt++;
}
}
if (arrFir.length != 0) {
document.form1.submit();
} else {
alert('삭제할 **를 선택하세요.');
return;
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="formprocess.jsp" id="checkList">
<input type="checkbox" onclick="javascript:checkAll(document.getElementsByName('check'), this.checked);" />전체선택
<input type="checkbox" name="check" value="1" /> 1
<input type="checkbox" name="check" value="2" /> 2
<input type="checkbox" name="check" value="3" /> 3
<input type="checkbox" name="check" value="4" /> 4
<input type="checkbox" name="check" value="5" /> 5
<input type="button" value="삭제" onclick="checkDel();">
</form>
</body>
</html>
<head>
<script language="javascript" type="text/javascript">
function checkAll(checkList, boolCheck) {
varchkSize = 0;
checkedCount = checkList.length;
if (typeof (checkedCount) != "undefined") {
for ( var i = 0; i < chkSize; i++) {
checkList[i].checked = boolCheck;
}
}
}
function checkDel() {
var chkFirList = document.getElementsByName('check');
var arrFir = new Array();
var cnt = 0;
for ( var idx = chkFirList.length - 1; 0 <= idx; idx--) {
if (chkFirList[idx].checked) {
arrFir[cnt] = chkFirList[idx].value;
cnt++;
}
}
if (arrFir.length != 0) {
document.form1.submit();
} else {
alert('삭제할 **를 선택하세요.');
return;
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="formprocess.jsp" id="checkList">
<input type="checkbox" onclick="javascript:checkAll(document.getElementsByName('check'), this.checked);" />전체선택
<input type="checkbox" name="check" value="1" /> 1
<input type="checkbox" name="check" value="2" /> 2
<input type="checkbox" name="check" value="3" /> 3
<input type="checkbox" name="check" value="4" /> 4
<input type="checkbox" name="check" value="5" /> 5
<input type="button" value="삭제" onclick="checkDel();">
</form>
</body>
</html>
수신측 소스
<html>
<head>
</head>
<body>
<%
String[] checks = request.getParameterValues("check");
int checklen = checks.length;
try {
for(int i=0; i<checklen; i++) {
out.println(checks[i]+";");
}
}
catch(Exception ex) {
out.println("exception occured");
}
%>
</body>
</html>
<head>
</head>
<body>
<%
String[] checks = request.getParameterValues("check");
int checklen = checks.length;
try {
for(int i=0; i<checklen; i++) {
out.println(checks[i]+";");
}
}
catch(Exception ex) {
out.println("exception occured");
}
%>
</body>
</html>
'# 웹 개발 > 프레임워크' 카테고리의 다른 글
jquery onload (0) | 2013.09.06 |
---|---|
checkbox All select (javascript 이용) (0) | 2013.09.06 |
게시판 파일 다운로드 시 image도 다운로드 가능하게 기능넣기 (0) | 2013.09.03 |
전자정부프레임워크 spring file download [톰캣이용한 방법] (0) | 2013.09.02 |
PostgreSQL insert into(자료입력), copy ~ form (0) | 2013.09.01 |