메뉴 건너뛰기

조회 수 2098 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<script type="text/javascript" src="/js/jquery-1.10.1.js"></script>
<script>
 function fnSubmit(){
  if(fnMemberValidation() == false) return;
  
  if(confirm("저장하시겠습니까?")){
   alert("OK");
  }else{
   return;
  }
 }
 
 function fnMemberValidation(){
  
  if($.trim($('#name').val()) == ''){
   alert("성명을 입력하십시오.");
   $('#name').focus();
   return false;
  }
  if($.trim($('#email').val()) == ''){
   alert("이메일주소를 입력하십시오.");
   $('#email').focus();
   return false;
  }else{
   var emailExp = /([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
   if(!emailExp.test($('#email').val())){
    alert("이메일주소가 유효하지 않습니다.");
    $('#email').focus();
    return false;
   }
  }
  if(!($('#genderM')[0].checked == true || $('#genderW')[0].checked == true)){
   alert("성별을 선택하십시오.");
   $('#genderM').focus();
   return false;
  }
  
  if($('#smsyn').is(':checked') == false){
   alert("동의하십시오.");
   $('#smsyn').focus();
   return false;
  }
  
  if(($.trim($('#zipcode1').val()) == '') || ($.trim($('#zipcode2').val()) == '')){
   alert("우편번호를 입력하십시오.");
   $('#zipcode1').focus();
   return false;
  }else{
   var zipExp = /^\d{3}-\d{3}/;
   var zipCode = $('#zipcode1').val() + "-" +  $('#zipcode2').val();
   if(!zipExp.test(zipCode)){
    alert("우편번호가 유효하지않습니다.");
    $('#zipcode1').focus();
    return false;
   }
  }
  
  return true;
 }
</script>
<title>JQuery폼체크</title>
</head>
<body>
<form id="frm" method="post" action="">
<table width="600" cellpadding="1" cellspacing="1" border="1">
 <colgroup><col width="20%"/><col width="80%"/></colgroup>
 <tr>
     <td><label for="name">성명</label></td>
     <td><input type="text" name="name" id="name" value="" title="성명"/></td>
 </tr>
 <tr>
        <td><label for="email">이메일</label></td>
     <td><input type="text" name="email" id="email" value="" title="이메일"/></td>
 </tr>
 <tr>
  <td><label for="gender">성별</label></td>
  <td>
   <input type="radio" name="gender" id="genderM" value="M" title="남"><label for="gender">남</label>&nbsp;
   <input type="radio" name="gender" id="genderW" value="W" title="여"><label for="gender">여</label>
  </td>
 </tr>
 <tr>
  <td><label for="smsyn">SMS수신여부</label></td>
  <td>
   <input type="checkbox" name="smsyn" id="smsyn" title="SMS수신여부"/> 
  </td>
 </tr>
 <tr>
     <td><label for="name">우편번호</label></td>
     <td>
      <input type="text" name="zipcode1" id="zipcode1" value="" title="우편번호앞" size="4"/>-
      <input type="text" name="zipcode2" id="zipcode2" value="" title="우편번호뒤" size="4"/>
     </td>
 </tr>
 <tr>
     <td colspan="2" align="center">
      <input type="button" value="저장" onclick="javascrip:fnSubmit();"/>
      <input type="reset" value="취소"/>
     </td>
 </tr>
</table>
</form>
</body>
</html>


List of Articles
번호 제목 날짜 조회 수
159 hover 메소드를 이용해서 메뉴 on, off를 구현 file 2016.09.21 8476
158 화면 이동시에 레이어가 따라다니게 하기 2016.09.21 7143
157 다른 프레임에 있는 객채 참조하는 방법 2016.09.21 6471
156 동적으로 콤보(select)의 항목(option) 생성하기 2016.09.21 14377
155 FORM 객체 초기화 하기 2016.09.21 7346
154 jQuery 예약어 $ 를 사용하지 못하는 경우 해결책 noConflict() 2016.09.21 6679
153 POST 방식으로 인수를 전달하고 그 결과를 받아오기 2016.09.21 9202
152 키보드 이벤트가 발생한 객체의 id값 알아내기 2016.09.21 7530
151 getScript() 2016.09.21 7125
150 속성선택자를 이용해서 링크에 스타일 입히기 2016.09.21 11561
149 getJSON() 함수 2016.09.21 8379
148 load() 메소드 2016.09.21 6412
147 zeroclipboard - 클립보드 복사하기(자바스크립트 클립보드 복사하기) 2016.10.06 7181
146 jquery 디데이 계산 (D-day,Dday) file 2016.11.17 8801
145 jquery 라디오버튼 선택 확인, 체크박스 선택 확인, 셀렉트박스 선택 확인 2016.11.17 7149
144 jquery 글자 byte, 문자열 byte(바이트) 길이 체크하기 예제 2016.11.17 8836
143 Html 색상표 모음, 색상코드표 (RGB), 이미지X, 복사 가능 file 2016.11.17 8145
142 Table을 DIV로 표현하기 (예제) file 2016.11.17 7468
141 jquery enter key event submit (jquery 엔터키 이벤트) 2016.11.17 6857
140 jQuery, JavaScript 새로고침(reload) 2016.11.17 6951
Board Pagination Prev 1 2 3 4 5 6 7 8 9 Next
/ 9

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved