묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
폼입력 검사 후에 포의 액션 때문에 다음페이지로 가버리는데..
2005.08.10 15:15
자바 스크립트로 폼입력 검사를 한 후 알림창에서 확인을 누르면 폼액션에서 지정한 페이지로
이동을 해버립니다.
아래 코드 보시고 도움 좀 부탁드립니다...
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>선택입력폼</title>
<!-- 주민등록 번호 입력폼 공백 및 자리수 검사 -->
<SCRIPT LANGUAGE="JAVASCRIPT">
function chkblank() {
chkobj=document.myForm.jumin;
if(blank(chkobj)==false || chkobj.value.length < 12) {
alert("숫자만입력하시고 주민번호 13자리만 입력해주십시요.");
chkobj.value="";
chkobj.focus();
}
}
//공백 체크 함수
function blank(ob) {
var cnt = 0;
for(i=0;i<ob.value.length;i++) {
if(ob.value.substring(i,i+1)==' ') ++cnt;
}
if(cnt>=1) return false;
}
</SCRIPT>
</head>
<body>
<form name='myForm' method='post' action='test01.php'>
<!-- onSubmit='return chkblank() -->
<table border="0" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC" width="623" align="center">
<tr>
<td width="613" height="3" bgcolor="#CCCCCC" colspan="4"></td>
</tr>
<tr>
<td width="99" bgcolor="white" height="34">
<p align="left">신청자명</p>
</td>
<td width="165" bgcolor="white" height="34">
<p><input type=text name=name size="20" maxlength="30" class=input></p>
</td>
<td width="100" bgcolor="white" height="34">주민등록번호</td>
<td width="222" bgcolor="white" height="34">
<p><input type=text name=jumin size="20" maxlength="13" class=input></p>
</td>
</tr>
<tr>
<td width="99" bgcolor="white" height="29">
<p align="left">배기량</p>
</td>
<td width="505" bgcolor="white" height="29" colspan="3">
<p><input type='radio' name='cc' value=1>50cc이하
<input type='radio' name='cc' value=2 checked>100cc이하
<input type='radio' name='cc' value=3>250cc이하
<input type='radio' name='cc' value=4>250cc이상 </p>
</td>
</tr>
<tr>
<td width="99" height="29" bgcolor="white">
<p align="left">사용용도</p>
</td>
<td width="505" height="29" bgcolor="white" colspan="3">
<p><input type='radio' name='sa' value="1" onClick="CheckChoice(this);" checked>출퇴근용
<input type='radio' name='sa' value="2" onClick="CheckChoice(this);">레저및투어용
<input type='radio'+ '+ ' name='sa' value="3" onClick="CheckChoice(this);">배달용
<input type='radio' name='sa' value="4" onClick="CheckChoice(this);">퀵서비스용</p>
</td>
</tr>
<tr>
<td width="613" height="51" colspan="4" bgcolor="white" valign="middle">
<p align="center"><input type='submit' value="보험료산출" OnClick="chkblank()">
</p>
</td>
</tr>
<tr>
<td width="613" colspan="4" height="3" bgcolor="#CCCCCC"></td>
</tr>
</table>
</form>
</body>
</html>
이동을 해버립니다.
아래 코드 보시고 도움 좀 부탁드립니다...
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>선택입력폼</title>
<!-- 주민등록 번호 입력폼 공백 및 자리수 검사 -->
<SCRIPT LANGUAGE="JAVASCRIPT">
function chkblank() {
chkobj=document.myForm.jumin;
if(blank(chkobj)==false || chkobj.value.length < 12) {
alert("숫자만입력하시고 주민번호 13자리만 입력해주십시요.");
chkobj.value="";
chkobj.focus();
}
}
//공백 체크 함수
function blank(ob) {
var cnt = 0;
for(i=0;i<ob.value.length;i++) {
if(ob.value.substring(i,i+1)==' ') ++cnt;
}
if(cnt>=1) return false;
}
</SCRIPT>
</head>
<body>
<form name='myForm' method='post' action='test01.php'>
<!-- onSubmit='return chkblank() -->
<table border="0" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC" width="623" align="center">
<tr>
<td width="613" height="3" bgcolor="#CCCCCC" colspan="4"></td>
</tr>
<tr>
<td width="99" bgcolor="white" height="34">
<p align="left">신청자명</p>
</td>
<td width="165" bgcolor="white" height="34">
<p><input type=text name=name size="20" maxlength="30" class=input></p>
</td>
<td width="100" bgcolor="white" height="34">주민등록번호</td>
<td width="222" bgcolor="white" height="34">
<p><input type=text name=jumin size="20" maxlength="13" class=input></p>
</td>
</tr>
<tr>
<td width="99" bgcolor="white" height="29">
<p align="left">배기량</p>
</td>
<td width="505" bgcolor="white" height="29" colspan="3">
<p><input type='radio' name='cc' value=1>50cc이하
<input type='radio' name='cc' value=2 checked>100cc이하
<input type='radio' name='cc' value=3>250cc이하
<input type='radio' name='cc' value=4>250cc이상 </p>
</td>
</tr>
<tr>
<td width="99" height="29" bgcolor="white">
<p align="left">사용용도</p>
</td>
<td width="505" height="29" bgcolor="white" colspan="3">
<p><input type='radio' name='sa' value="1" onClick="CheckChoice(this);" checked>출퇴근용
<input type='radio' name='sa' value="2" onClick="CheckChoice(this);">레저및투어용
<input type='radio'+ '+ ' name='sa' value="3" onClick="CheckChoice(this);">배달용
<input type='radio' name='sa' value="4" onClick="CheckChoice(this);">퀵서비스용</p>
</td>
</tr>
<tr>
<td width="613" height="51" colspan="4" bgcolor="white" valign="middle">
<p align="center"><input type='submit' value="보험료산출" OnClick="chkblank()">
</p>
</td>
</tr>
<tr>
<td width="613" colspan="4" height="3" bgcolor="#CCCCCC"></td>
</tr>
</table>
</form>
</body>
</html>
댓글 0
글쓴이 | 제목 | 최종 글 |
---|---|---|
XE | 공지 글 쓰기,삭제 운영방식 변경 공지 [16] | 2019.03.05 by 남기남 |
벨몽이 | 글쓰고 나서 쓴 글이 뜨게 하는법좀.. 그냥 목록이 나오네요 | |
alljoy |
레이아웃의 사용자정의 메뉴?
[2]
![]() | 2013.12.03 by 콩치 |
ironage | 가상주소로 보내기? [1] | 2013.12.03 by Canto |
CMADE | 제로보드4 질문 드려봅니다. | |
leeside |
레이아웃 css gnb 메뉴쪽 편집관련 간단한 질문드려요
![]() | |
소피스타 | 회원가입 할때 임의의 필드추가. [2] | 2013.12.03 by 소피스타 |
BrownRice | 외부페이지 공백 문제 | |
하늘(skycheer) | 모바일에서...숫자 클릭시 전화걸기 문의 드립니다. [2] | 2013.12.03 by explode |
나이스장 |
레이아웃 스킨에서 조금 이상하게
![]() | |
라피에르 | 언제부턴가 xe공식홈페이지가 이상한 말로나와요ㅠㅠ [3] | 2013.12.03 by explode |
trule0425 |
레이아웃 생성이 안되는 경우
[1]
![]() | 2013.12.03 by explode |
jeni660 | 게시물 작성시 관리자 이메일로 기능 [1] | 2013.12.03 by explode |
소피스타 | 로그인 성공하면 방문자 id와 ip 접속시간을 db에 남기고 싶습니다. [1] | 2013.12.03 by explode |
인지상정 | XE 버전업후 익스10에서 게시판이 오류가 심각합니다. [1] | 2013.12.03 by 쿡래빗 |
아이구머리 | 본문 아래에 목록이 출력되지 않게 하려는데 도와주세요ㅠ [1] | 2013.12.03 by 처리낭군 |
imvv99z |
1.7대버전은 게시판생성 버튼이없네요.
[3]
![]() | 2013.12.03 by 때린데 또때려 |
PodongS2 | 비회원 추천하는 방법좀 봐주세요~~ [1] | 2013.12.02 by 처리낭군 |
rallablue | 마땅한 답변이 없어서 다시 올려요 덧글오류 [1] | 2013.12.02 by 처리낭군 |
나이스장 | 홈페이지에 sns기능 | |
imapop | 게시판 url |