Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/03/2012, 09:28
damianladiani
 
Fecha de Ingreso: febrero-2012
Mensajes: 10
Antigüedad: 12 años, 2 meses
Puntos: 0
Boton buscar palabra anterior

Hola a todos!

Queria hacer una consulta: encontre el siguiente fragmento de codigo javascript, que me permite buscar la siguiente palabra que ingrese en un text

function findBackString (str)
{

//document.f1.inicio.value=str;
//document.f1.inicio.focus()

if (parseInt(navigator.appVersion)<4) return;
var strFound;
if (navigator.appName=="Netscape") {

// NAVIGATOR-SPECIFIC CODE

strFound=self.find(str);
if (!strFound) {
strFound=self.find(str,0,1)
while (self.find(str,0,1)) continue
}
}

if (navigator.appName.indexOf("Microsoft")!=-1)
{

// EXPLORER-SPECIFIC CODE

if (TRange!=null) {
TRange.collapse(false)
strFound=TRange.findText(str)
if (strFound) TRange.select()
}
if (TRange==null || strFound==0) {
TRange=self.document.body.createTextRange()


strFound=TRange.findText(str)
if (strFound) {TRange.select();}
}
}
if (!strFound) alert ("No se encuentra la palabra '"+str+"'")
}

Esto hace que funcione mi boton "buscar siguiente", pero no se cual seria la modificacion que tendria que hacer para que pueda "buscar anterior", es decir, si el usuario se pasa una palabra, poder volver a la anterior.

Alguien lo sabe? desde ya, muchas gracias.