<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
// Version 2
var arr = new Array();
arr[0] = new Array('http://www.tutorias.de','http://www.google.de','http://www.drweb.de','http://devedge.netscape.com','http://msdn.microsoft.com','http://www.mozilla.org');
arr[1] = new Array('10000000','20000000','30000000','40000000','50000000','60000000');
var arr_set = new Array('0','0')
// popup('0','canditate',suggestion)
function popup(arr_id,from_id,container) //popup(0,0)
{
//Selectfeld schreiben
if(arr_set[arr_id] == '0'){
//Selectfield schreiben
tbl = arr[arr_id].length
document.getElementById(from_id).size = tbl+1;
//Select füllen
for(var i=0; i<tbl; i++){
new_entry = new Option(arr[arr_id][i],arr[arr_id][i],false,false);
document.getElementById(from_id).options[document.getElementById(from_id).length] = new_entry;
}
//arr_text_set setzen
arr_set[arr_id] = 1;
show_hide('show',container);
}else{
show_hide('show',container);
}
}
function show_hide(mode,container){
if(mode=='show'){
document.getElementById(container).style.display = 'block';
}else if(mode=='hide'){
document.getElementById(container).style.display = 'none';
}else{
alert('error');
}
}
function transfer(si, id_to, id_from, parent_from_id){
document.getElementById(id_to).value = document.getElementById(id_from).options[si].text;
show_hide('hide',parent_from_id);
}
</script>
<style type="text/css">
.suggestion{
display:none;
position:absolute;
width:200px;
height:0px;
z-index:1;
border:1px solid black;
}
input, select{
width:200px;
}
</style>
</head>
<body>
<form name="demo">
<input type="text" name="textbox" id="textbox" onFocus="popup('0','canditate','suggestion')"> URL eingeben <br>
<span id="suggestion" class="suggestion">
<select id="canditate" onClick="transfer(this.selectedIndex,'textbox',this.id,'suggestion')"></select>
</span>
<input type="text" name="textbox2" id="textbox2" onFocus="popup('1','canditate2','suggestion2')"> XXX eingeben <br>
<span id="suggestion2" class="suggestion">
<select id="canditate2" onClick="transfer(this.selectedIndex,'textbox2',this.id,'suggestion2')"></select>
</span>
</form>
</body>
</html>