Una cosa simile al "Trova" di Word insomma. Esiste un codice JavaScript che ti permette di farlo e dovrebbe (non ho mai provato) funzionare anche con Netscape oltre che con Explorer...con altri browser non lo so.
codice:
Funzione JavaScript:
<script type="text/javascript">
<!--
var NS4 = (document.layers);
var IE4 = (document.all);
var win = window; /* Può essere impostato anche il percorso
di un frame specificando top.NOMEFRAME al posto di window */
var n = 0;
function TrovaTesto(str) {
var txt,i,found;
if (str=="")
return false;
if (NS4) {
if (!win.find(str))
while (win.find(str,false,true)) n++;
else n++;
if (n==0)
alert("Testo non trovato.");
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i=0; i<=n && (found = txt.findText(str))!=false; i++) {
txt.moveStart("character",1);
txt.moveEnd("textedit");
}
if (found) {
txt.moveStart("character",-1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else {
if (n>0) {
n = 0;
TrovaTesto(str);
}
else
alert("Testo non trovato.");
}
}
return false;
}
-->
</script>
Codice del form:
<form name="Modulo">
<input type="text" name="Testo" onchange="n=0;">
<input type="button" value="Cerca"
onclick="return TrovaTesto(document.Modulo.Testo.value);">
</form>
Dovrebbe funzionare così.