라디오와 셀렉트값 입력여부 체크하기(radio , select) > JavaScript

본문 바로가기
사이트 내 전체검색

JavaScript

라디오와 셀렉트값 입력여부 체크하기(radio , select)

페이지 정보

profile_image
작성자 최고관리자
댓글 0건 조회 6,557회 작성일 21-02-10 17:21

본문

라디오의 경우...................

for(var i=0 ; i < form.라디오명.length; i++){
    if(form.라디오명[i].checked == true) break;
 }
 if(i == form.라디오명.length){
  alert ("경고문....");
  return;
 }




셀렉트인 경우

if(!form.셀렉트명.selectedIndex){
  alert("경고문....");
  return;
 }

 --------------------------------------------------------------
 "php웹프로그래밍 가이드(출판사:마이트Press)"에서



**....
select 값 자바스크립트 체크

<select name=name2 OnChange='scriptFunction(Form.name2.options[Form.name2.selectedIndex].value)'>
    <option value='a'>aaa</option>
    <option value='b'>bbb</option>
 </select>
-- 즉 --
- formname.selectname.selectedIndex  == 0 , 1<- 선택된 배열 값
- formname.selectname.options[선택된 배열 값].value == a, b <- 선택된 배열의 value 값
- formname.selectname.options[선택된 배열 값].text == aaa,bbb <- 선택된 배열의 text 값

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

  • 게시물이 없습니다.

접속자집계

오늘
1,227
어제
4,401
최대
6,642
전체
887,190
contact : webmaster@beautipia.co.kr
Copyright © beautipia.co.kr. All rights reserved.