Foros del Web » Programando para Internet » Javascript »

scroller que guarde posición

Estas en el tema de scroller que guarde posición en el foro de Javascript en Foros del Web. Hola a todo. mi pregunta es saber si es posible guardar la posición de un scroller. Es decir. Tengo un DIV donde mediante un par ...
  #1 (permalink)  
Antiguo 13/06/2006, 04:17
 
Fecha de Ingreso: noviembre-2002
Mensajes: 130
Antigüedad: 21 años, 5 meses
Puntos: 0
scroller que guarde posición

Hola a todo.
mi pregunta es saber si es posible guardar la posición de un scroller. Es decir. Tengo un DIV donde mediante un par de flechas sube y baja el texto de este. El texto en realida lo utilizo como menú de cursos. Y a primera vista aparecen 10, pero realmente hay más de 20. Subiendo y bajando el scroll voy hasta el curso en concreto lo selecciono y me lo despliega mediante php y mysql el curso seleccionado. El problema que me encuentro es que si selecciono uno que esté en la posición 18, al volver a recargar la página evidentemente no veo que se haya seleccionado, ya que queda fuera del rango de los 10 visible. Y debo ir con el scroll buscando hasta encontrar el curso seleccionado.
Es un problema ya que si quiero hacer un vistazo rápido atodos los cursos debo ir uno a uno y tirando del scroll. Si fueran 5 no hay problema, pero como digo,pueden llegar hasta 25 cursos distintos, y evidentemente es muy incómodo para navegar.

No se si me explico bien


Gracias por anticipado

Les dejo el código por si sirve de ayuda

Código HTML:
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="24" rowspan="2"><img src="myadmin/imatges/fons_menu_esq.jpg" width="24" height="19"></td>
          <td background="myadmin/imatges/fons_menu_dot.jpg"><img src="myadmin/imatges/spacer.gif" width="30" height="2"></td>
          <td width="22" rowspan="2"><img src="myadmin/imatges/fons_menu_dret.jpg" width="22" height="19"></td>
        </tr>
        <tr>
          <th background="myadmin/imatges/fons_menu_dot.jpg"><div align="center"><A ONMOUSEDOWN="return doScrollerIE('up','s1',40)" 
     ONMOUSEOUT="clearInterval(sRepeat)" HREF="#"><img src="myadmin/imatges/up.jpg" width="28" height="9" border="0"></A></div></th>
        </tr>
      </table>
	  <DIV ID=s1 STYLE="width: 250; height: 100; overflow: hidden; border:0px black solid">
	  <?
	$ssql = "SELECT * FROM cursos where id ='$id'";
		$resulta = mysql_query($ssql,$conexion);
		$rs=mysql_fetch_object($resulta);

	
		$ssql = "SELECT * FROM cursos";
		$result = mysql_query($ssql,$conexion);
		while ($rss=mysql_fetch_object($result)){
	?> <SCRIPT>
var sRepeat=null
function doScrollerIE(dir, src, amount) {
	if (amount==null) amount=10
	// Move the top of the contents up or down
	// in the viewport
	if (dir=="up")
		document.all[src].scrollTop-=amount
	else
		document.all[src].scrollTop+=amount

	// Check if to repeat
	if (sRepeat==null)
		sRepeat = setInterval("doScrollerIE('" + dir + "','" + src + "'," + amount + ")",100)
	return false
}

// Used to end repeating scrolling
window.document.onmouseup = new Function("clearInterval(sRepeat);sRepeat=null")
window.document.ondragstart = new Function("return false")
    </SCRIPT>   
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="24" rowspan="2" background="myadmin/imatges/fons_menu_esq.jpg"><img src="myadmin/imatges/fons_menu_esq.jpg" width="24" height="19"></td>
          <td background="myadmin/imatges/fons_menu_linia.jpg"><img src="myadmin/imatges/spacer.gif" width="30" height="2"></td>
          <td width="22" rowspan="2" background="myadmin/imatges/fons_menu_dret.jpg"><img src="myadmin/imatges/fons_menu_dret.jpg" width="22" height="19"></td>
        </tr>
        <tr>
          <th <?php if  ($id==$rss->id) print "bgcolor=\"#FFFFFF\""; else print "bgcolor=\"#01A8EC\""; ?> onMouseOver="filaMouseOver(this)" onMouseOut="filaMouseOut(this)" onClick="document.location='mostrar.php?id=<?php echo $rss->id;?>'"><div align="left"><img src="myadmin/imatges/spacer.gif" width="5" height="8" align="absmiddle"><?php echo $rss->Nom;?></div></th>
        </tr>
      </table> 
	  <? } ?></div>
	  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="24" rowspan="2"><img src="myadmin/imatges/fons_menu_esq.jpg" width="24" height="19"></td>
          <td background="myadmin/imatges/fons_menu_dot.jpg"><img src="myadmin/imatges/spacer.gif" width="30" height="2"></td>
          <td width="22" rowspan="2"><img src="myadmin/imatges/fons_menu_dret.jpg" width="22" height="19"></td>
        </tr>
        <tr>
          <th background="myadmin/imatges/fons_menu_dot.jpg"><div align="center"><A ONMOUSEDOWN="return doScrollerIE('down','s1',40)" 
     ONMOUSEOUT="clearInterval(sRepeat)" HREF="#"><img src="myadmin/imatges/down.jpg" width="28" height="9" border="0"></A></div></th>
        </tr>
      </table> 
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:43.