Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script>
var M = new Array()//array que contendra los nuevos objetos
var abierto = 0; //variable que indica si el menú esta o no abierto
var retardo = 5; // valor Time de la función setTimeout
var speed = 2; // incemento de count
var nX = 0; // contendra el número de elementos
var caja = 0; // contendra los elementos
function MO(n)
{
this.is = caja[n];
this.clic = function()
{
with(this)
{
if (abierto){left = -100;count = 0;abierto = 0}
else {left = 0;count = -100;abierto = 1;}
Mmenu(count, left, n);
}
}
}
onload = function()
{
divs = document.getElementById("menu");
caja = divs.getElementsByTagName("div")
nX = caja.length;
for (var i=0;i<nX;i++)
{
M[i] = new MO(i);
}
}
function Mmenu(count, left, n)
{
if (count!=left)
{
if (count>left){count -= speed;}
else{count += speed;}
M[n].is.style.left = Math.round(count);
setTimeout('Mmenu(' + count + ',' + left + ',' + n + ')', retardo);
}
}
</script>
<style>
a {
text-decoration:none;
font-family:helvetica;
font-weight:bold;
color:#000;
}
</style>
</head>
<body>
<menu id="menu">
<div onclick=M[0].clic() style="position:absolute;background-image:url(menu.gif);background-repeat:no-repeat;width:120px;height:100%;left:-100px;top:0;">
<br />
-<a href="#"> Capitulo 1</a><br />
-<a href="#"> Capitulo 2</a><br />
-<a href="#"> Capitulo 3</a><br />
-<a href="#"> Capitulo 4</a><br />
-<a href="#"> Capitulo 5</a><br />
-<a href="#"> Capitulo 6</a><br />
-<a href="#"> Capitulo 7</a><br />
<br />
</div>
<div onclick=M[1].clic() style="position:absolute;background-image:url(menu.gif);background-repeat:no-repeat;width:120px;height:100%;left:-100px;top:300px;">
<br />
-<a href="#"> Capitulo 1</a><br />
-<a href="#"> Capitulo 2</a><br />
-<a href="#"> Capitulo 3</a><br />
-<a href="#"> Capitulo 4</a><br />
-<a href="#"> Capitulo 5</a><br />
-<a href="#"> Capitulo 6</a><br />
-<a href="#"> Capitulo 7</a><br />
<br />
</div>
</menu>
</body>
</html>

