Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/12/2009, 07:24
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 18 años, 3 meses
Puntos: 126
Respuesta: desplazarse por la base de datos

Hola

A ver si esto funciona

+ Usas GetRows() para tener todos los registros en un array

Código ASP:
Ver original
  1. registros = rs.getrows()

+ Ahora un ciclo

Código ASP:
Ver original
  1. valores = ""
  2. For i = 0 to UBound(registros,2)
  3. valores = valores & registros(0,i) & ","
  4. Next 'i

+ Ahora en javascript


Código Javascript:
Ver original
  1. var ns4 = (document.layers)? true:false
  2. var ie4 = (document.all)? true:false
  3. var ns6 = (document.getElementById)? true:false
  4. var b=0;
  5. var noticia = [<&#37;=Left(valores,Len(valores)-1)%>];
  6.  
  7. function obj(x){
  8.     if (ns6)
  9.     {
  10.     return document.getElementById(x);
  11.     }
  12.     else if (ie4)
  13.     {
  14.     return document.all[x];
  15.     }
  16.     else if (ns4)
  17.     {
  18.     return document.layers[x];
  19.     }
  20.     else
  21.     {
  22.     return null;
  23.     }
  24. }
  25.  
  26.  
  27. function mostrar(a){
  28.     obj("t_noticia").innerHTML=noticia[a].titulo;
  29.    
  30. }
  31.  
  32.  
  33. function cambiar(incr){
  34. b=(noticia.length>b+incr)?b+incr:0;
  35.     if(b==-1){
  36.         b=noticia.length-1;
  37.     }
  38.     mostrar(b);
  39. }

+ En el body

Código HTML:
Ver original
  1. <div id="t_noticia"></div>
  2. <a href="#" onClick="cambiar(-1);">Anterior</a> | <a href="#" onClick="cambiar(1);">Siguiente</a></td>

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />