ÀÔ·ÂÄ­¿¡¼­ ¹®ÀÚ¸¦ ¼±ÅÃÇØ º¸¶ó





¸¶¿ì½º¸¦ ÇØ´ç ÀÔ·Ââ¿¡ Ŭ¸¯ÇÏ´ø°¡, Tab À¸·Î Çʵ带 À̵¿ÇÏ¿© ÇØ´ç °³Ã¼¿¡ Æ÷Ä¿½º¸¦ ÁÖ¸é(onfocus ±â´ÉÇÔ¼ö¿¡ ÀÇÇØ ÇØ´ç °³Ã¼ÀÇ °ªÀ¸·Î ÇØ´ç °³Ã¼¿¡ ¹è°æ»öÀ» º¯°æ½ÃÄÑÁØ´Ù.
°°Àº ¹æ½ÄÀ¸·Î ´Ù¸¥ Çʵå·Î À̵¿Çϰųª ÇÊµå ¹ÛÀ¸·Î Æ÷Ä¿½º°¡ À̵¿Çϸé Æ÷Ä¿½º »ó½Ç(onblur)·Î ±â´ÉÇÔ¼ö¿¡ ÀÇÇØ ¿ø·¡ÀÇ ¹è°æ»öÀ¸·Î ȯ¿øÇÑ´Ù.

<SCRIPT>
function paint(obj,color){
  obj.style.backgroundColor=color;
}
function hideit(obj){
  obj.style.backgroundColor='';
}
</SCRIPT>;

<FORM name="f3">ÀÔ·ÂÄ­¿¡¼­ ¹®ÀÚ¸¦ ¼±ÅÃÇØ º¸¶ó<BR>
<INPUT type="text" name="i1" onFocus="paint(this,this.value)" onBlur="hideit(this)" value="pink"><BR>
<INPUT type="text" name="i2" onFocus="paint(this,this.value)" onBlur="hideit(this)" value="yellow"><BR>
<INPUT type="text" name="i3" onFocus="paint(this,this.value)" onBlur="hideit(this)" value="aqua"><BR>
<INPUT type="text" name="i3" onFocus="paint(this,this.value)" onBlur="hideit(this)" value="lightgreen"><BR>
<INPUT type="button" name="i4" onFocus="paint(this,this.value)" onBlur="hideit(this)"  value="orange"><BR>
</FORM>


ÀÔ·ÂÇʵåµé°ú ´Ù¸¥ °÷¿¡ Æ÷Ä¿½º¸¦ À̵¿½ÃÄÑ º¸¶ó.
¶ÇÇÑ ÀԷ¶õ1¿¡ Æ÷Ä¿½º¸¦ ÁÖ°í Æ÷Ä¿½º º¯°æ Ŭ¸¯À» ÇØ º¸¶ó. Javascript¿¡ ÀÇÇØ ÀÚµ¿ÀûÀ¸·Î ÀԷ¶õ2·Î Æ÷Ä¿½º°¡ À̵¿ÇÑ´Ù.

<FORM name="testForm">
<INPUT type="text" name="input1" value="ÀԷ¶õ 1"
  onFocus="show1.innerHTML='onfocus'"
  onBlur="show1.innerHTML='onblur'">
  <SPAN id=show1></SPAN><BR>
<INPUT type="text" name="input2" value="ÀԷ¶õ 2"
  onFocus="show2.innerHTML='onfocus'"
  onBlur="show2.innerHTML='onblur'">
 <SPAN id=show2></SPAN><BR>
<INPUT type="button" value="Æ÷Ä¿½º º¯°æ Ŭ¸¯"
  onClick=jsTest()> <! ÀÌ ´ÜÃ߸¦ Ŭ¸¯ÇÏ¸é ½ÇÁ¦ÀûÀ¸·Î´Â Æ÷Ä¿½º°¡ ÀÌ ´ÜÃß·Î ¿À´Âµ¥ ±â´ÉÇÔ¼ö·Î º¯°æ½ÃŲ´Ù.>
 <SPAN id=show3></SPAN><BR>
</FORM>

<SCRIPT>
testForm.input2.focus() // ÃÖÃÊ¿¡ ¿¡ Æ÷Ä¿½º¸¦ ÁØ´Ù

function jsTest(){
  if (testForm.input1.focus) testForm.input2.focus(); // Æ÷Ä¿½º°¡ ÀԷ¶õ 1¿¡ ÀÖÀ¸¸é ÀԷ¶õ 2·Î Æ÷¼­½º¸¦ À̵¿½ÃŲ´Ù.
}
</SCRIPT>