die daten kommen wirklich vom server...
aber egal....
am besten ist, das du keine textbox sondern etwas wie:
Code
<input type="text" id="suche" onkeypress="javascript:check(this.value);" />
<script language="javascript1.1" type="text/jscript">
<!--
var content = new Array();
content[]="Begriff1";
content[]="Begriff2";
content[]="Begriff3";
function check( val )
{
val=val.toLowerCase();
var anzeige = new Array();
for(i=0 ; i<=content.length ; i++)
{
if (content[i].substr(0, val.length)==val)
{
anzeige[]=content[i];
}
}
if (anzeige.length>0)
{
show_list(anzeige);
}
}
function show_list(anzeige)
{
var augabe='';
for(i=0 ; i<=anzeige.length ; i++)set_it
{
augabe+='[url='#']' + anzeige[i] + '[/url]
';
}
document.getElmentById('promptdiv').innerHTML=augabe;
document.getElmentById('promptdiv').style.display = "block";
}
function set_it ( too )
{
document.getElmentById('suche').value=too;
document.getElmentById('promptdiv').style.display = "none";
}
-->
</script>
<style type="text/css">
#promptdiv {
display:none;
position:absolute;
top:50%;
left:50%;
margin:-250px auto auto -200px;
background-color:#aaa;
width:200px;
height:160px;
padding:5px;
border:2px outset #abc;
}
</style>
<div class="promptdiv">
</div>
Alles anzeigen
ich habe es nicht getest, aber es sollte gehen, oder es zumindest verdeutlichen, wie es geht...
das
content[]="Begriff1";
content[]="Begriff2";
content[]="Begriff3";
wird dann mit PHP generiert...