Web/Javascript_Jquery

이메일 뒷자리 셀렉트박스 자동선택

벨포트조던 2016. 3. 11.
반응형

function eMailCh1(selectEmail2){

if(selectEmail2.value =='direct'){

$(selectEmail2).prev().attr("readonly",false);

$(selectEmail2).prev().focus();

}else{

$(selectEmail2).prev().val(selectEmail2.value);

$(selectEmail2).prev().attr("readonly",true);

}


}




더 간단한 방법



<select class="select3" id="EMAIL3" onchange='$("#EMAIL2").val($(this).val())'>

<option value="">직접입력</option> 

<option value="naver.com">네이버</option> 

<option value="nate.com">네이트</option> 

<option value="daum.net">다음</option> 

<option value="gmail.com">Gmail</option> 

</select>








---------------------------------------------------------------------------------

php 인데 다른데서도 다 쓸수 있을듯



<span>이메일</span>

<input type="text" title="메일이름" id="email1" class="i150" value="" name="email[]">

@

<input type="text" title="메일도메인" id="email2" class="i150" value="" name="email[]">

<select onchange="document.apply_frm['email[]'][1].value = this.value" title="메일선택">

<option>직접 입력</option>

<option value="nate.com">네이트</option>

<option value="lycos.co.kr">라이코스</option>

<option value="hotmail.com">핫메일</option>

<option value="yahoo.co.kr">야후</option>

<option value="hanmail.net">한메일</option>

<option value="netian.com">네띠앙</option>

<option value="freechal.com">프리챌</option>

<option value="empal.com">엠팔</option>

<option value="naver.com">네이버</option>

<option value="dreamwiz.com">드림위즈</option>

<option value="hanafos.com">하나포스</option>

<option value="korea.com">코리아닷컴</option>

<option value="chollian.net">천리안</option>

<option value="hanmir.com">한미르</option>

<option value="hitel.net">하이텔</option>

</select>

반응형

댓글