<script language="javascript">
var i = 0;
var timer = 0;
/* Funzione per interrompere lo scroll. */
function stop()
{
if (timer) clearInterval(timer);
}
/* Questa funzione controlla se lo scroll è verso l'alto o verso il *
* basso. */
function start(index)
{
if (index == 5)
{
timer = setInterval("go(5)",50);
}
else
{
timer = setInterval("go(-5)",50);
}
}
/* Funzione di scroll */
function go(dat)
{
i += dat;
if(i > 0) top.sinistra.window.scrollTo(0,i);
}
</script>
</head>
<body>
<p onmouseover="start(-5)" onmouseout="stop()">Su</p>
<p onmouseover="start(5)" onmouseout="stop()">Giù</p>
...
Domanda:
Come posso sapere quando è arrivato al limite inferiore ?