<HTML>

<HEAD>

<style>
TD{font-family:verdana; font-size:9pt}

SELECT{font-family:verdana; font-size:9pt}

INPUT{font-family:verdana; font-size:9pt}

</style>

<SCRIPT LANGUAGE="JavaScript">

<!--

var arr_string = new Array("김", "김태", "김태희", "김태희 사진", "김태희 싸이");

////////////////////↑DB에서 불러와 배열을 만든다/////////////////////



function input_key(word)

{

if(window.event.keyCode == 40)

{

if (document.all.word_select)

{

document.all.word_select.focus();

document.all.word_select.options[0].selected = true;

}

}

else{

auto_list(word);

}

}



function auto_list(word)

{

var arr_option = new Array();

var k = 0;

// self.status = word;

for (i=0; i<arr_string.length; i++)

{

if(arr_string[i].substring(0, word.length) == word && arr_string[i].substring(0,

word.length) != null)

{

arr_option[k] = arr_string[i];

k = k + 1;

}

}

if(k != 0 && word.length != 0)

{

select.innerHTML = "<select multiple name=\"word_select\" size=\"10\"

style=\"width:250px; height:100px\" onchange=\"document.all.word.value=this.value\"></select>";

for (j=0; j<arr_option.length; j++)

{

document.all.word_select.options[j] = new Option(arr_option[j], arr_option

[j]);

}

document.all['select'].style.visibility = "visible";

}

else{

document.all['select'].style.visibility = "hidden";

}

}

//-->

</SCRIPT>

</HEAD>



<BODY onload="document.all.word.focus();">

<form name="test">

<TABLE width="320" border="0" cellpadding="0" cellspacing="0">

<TR>

<TD width="250"><input type="text" onkeyup="input_key(this.value);" name="word"

style="width:100%"></TD>

<TD><button>search</button></TD>

</TR>

</TABLE>

<div id="select" style="visibility:hidden"><div>

</form>

</BODY>

</HTML>

+ Recent posts