Bhe come l'hai impostato tu funziona, ma io nel frattempo ho creato un "contenitore" con all'interno il form e i risultati come mi hai suggerito
Se io nelle proprietà del "contenitore" metto "float:left", non significa che tutti gli elementi innestati ad esso devono essere predisposti uno di fianco a l'altro? Perchè devo ripetere il float:left per ogni elemento?
Codice PHP:
<html>
<head>
<title>Cerca Ragione Sociale</title>
<style type="text/css">
form
{
background-color:#996600;
width:30%;
font-family:"Arial Black", Gadget, sans-serif;
color:#FFF;
float:left;
height:30px
}
#risultati
{
width:70%;
background-color:#0099FF;
font-family:"Arial Black", Gadget, sans-serif;
color:#FFF;
margin:0;
}
#container
{
width:100%;
float:left;
}
</style>
</head>
<body>
<div id="container">
<form action="">
<label>Inserisci ragione sociale</label>
<input name="chiave" onKeyUp="showHint(this.value)"/>
</form>
<p id="risultati">Risultati: <span id="txtHint"></span></p>
</div>
<script>
function showHint(str)
{
var xmlhttp;
if (str.length==0) //se non è stato inserito alcun valore
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)// code for IE7+, Firefox, Chrome, Opera, Safari
{xmlhttp=new XMLHttpRequest();}
else // code for IE6, IE5
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{document.getElementById("txtHint").innerHTML=xmlhttp.responseText;}
}
xmlhttp.open("GET","cerca_ragione_sociale.asp?chiave="+str,true);
xmlhttp.send();
}
</script>
</body>
</html>
scusa se sono un po' ottuso