ciao a tutti,
Fedina ti butto un'idea... la parte iniziale rimane uguale, da qua facendo qualche modifica
codice:
...
...
function filtra(erTesto,idaperto){
if(!idaperto)idaperto=''
div = document.getElementById('divNomi')
div.innerHTML=''
HTMLbase = document.getElementById('divBase').innerHTML
for(i=0;i<aNomi.length;i++){
txt = aNomi[i].Ditta
txt = txt.substr(0,erTesto.length)
if(txt.toLowerCase()==erTesto.toLowerCase() || erTesto==''){
html = HTMLbase.replace(/\[Ditta\]/g,aNomi[i].Ditta)
html = html.replace(/\[Ref\]/g,aNomi[i].Ref)
html = html.replace(/\[Ref1\]/g,aNomi[i].Ref1)
html = html.replace(/\[Ref2\]/g,aNomi[i].Ref2)
html = html.replace(/\[Indirizzo\]/g,aNomi[i].Indirizzo)
html = html.replace(/\[Indirizzo1\]/g,aNomi[i].Indirizzo1)
html = html.replace(/\[Tel\]/g,aNomi[i].Tel)
html = html.replace(/\[Tel1\]/g,aNomi[i].Tel1)
html = html.replace(/\[Tel2\]/g,aNomi[i].Tel2)
html = html.replace(/\[Fax\]/g,aNomi[i].Fax)
html = html.replace(/\[Fax1\]/g,aNomi[i].Fax1)
html = html.replace(/\[Fax2\]/g,aNomi[i].Fax2)
html = html.replace(/\[Cellulare\]/g,aNomi[i].Cellulare)
html = html.replace(/\[Cellulare1\]/g,aNomi[i].Cellulare1)
html = html.replace(/\[Email\]/g,aNomi[i].Email)
html = html.replace(/\[Homepage\]/g,aNomi[i].Homepage)
html = html.replace(/\[Altrenote\]/g,aNomi[i].Altrenote)
html = html.replace(eval('\/class=nascosto id='+idaperto+'\/g'),' class=visibile id='+idaperto+'')
div.innerHTML+=html+'
\n'
}
}
}
</script>
<style>
.nascosto{
visibility:hidden;
position:absolute;
}
.visibile{
visibility:visible;
position:relative;
}
</style>
</HEAD>
<BODY onload="filtra('','x')">
<form>
<input type="text" name="testo" onkeyup="filtra(this.value,'x')">
</form>
<div id="divNomi"></div>
<div id="divBase" class="nascosto">
<table border="1" id="aa[Ditta]">
<tr>
<td>+</td><td>Ditta</td><td width="150">[Ditta]</td>
</tr>
<td colspan="3">
<table border="1" id="bb[Ditta]" class="nascosto">
<tr>
<td>-</td><td>Ditta</td><td width="150">[Ditta]</td>
</tr>
<tr>
<td colspan="2">Referente</td><td>[Ref]</td>
</tr>
<tr>
<td colspan="2">Referente #1</td><td>[Ref1]</td>
</tr>
<tr>
<td colspan="2">Referente #2</td><td>[Ref2]</td>
</tr>
<tr>
<td colspan="2">Indirizzo #1</td><td>[Indirizzo]</td>
</tr>
<tr>
<td colspan="2">Indirizzo #2</td><td>[Indirizzo1]</td>
</tr>
<tr>
<td colspan="2">Telefono #1</td><td>[Tel]</td>
</tr>
<tr>
<td colspan="2">Telefono #2</td><td>[Tel1]</td>
</tr>
<tr>
<td colspan="2">Telefono #3</td><td>[Tel2]</td>
</tr>
<tr>
<td colspan="2">Fax #1</td><td>[Fax]</td>
</tr>
<tr>
<td colspan="2">Fax #2</td><td>[Fax1]</td>
</tr>
<tr>
<td colspan="2">Fax #3</td><td>[Fax2]</td>
</tr>
<tr>
<td colspan="2">Cellulare #1</td><td>[Cellulare]</td>
</tr>
<tr>
<td colspan="2">Cellulare #2</td><td>[Cellulare1]</td>
</tr>
<tr>
<td colspan="2">Email</td><td>[Email]</td>
</tr>
<tr>
<td colspan="2">Homepage</td><td>[Homepage]</td>
</tr>
<tr>
<td colspan="2">Altre note</td><td>[Altrenote]</td>
</tr>
</table>
</td>
</table>
</div>
</BODY>
</HTML>
sono un po' impegnato per sistemarlo bene... ma più o meno dovrebbe andare