Mira hice un modelo, funciona, solo lo probe en IE y FF, me dices como anda,
les quite las viñetas a propósito a las listas con
Código HTML:
<style>
li{list-style:none;}
</style>
![U_U](http://static.forosdelweb.com/fdwtheme/images/smilies/nods.png)
porque al ocultarlas y luego mostrarlas no aparecian, bueno tarea para la casa
salu2
Código HTML:
Ver original<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> li{list-style:none;}
var limite_lista=6; //INDICA ELEMENTOS A MOSTRAR
var valb=["Mostrar","Ocultar"];
function op(o,v){
num=o.replace(/\D/g,'');
document.getElementById("bot"+num).value=(v==valb[0])? valb[1]:valb[0];
x=document.getElementById("lista"+num).getElementsByTagName("li")
for(n=limite_lista;n<x.length;n++){
estado=x.item(n).style;
if(estado.display=="none")
estado.display="block";
else
estado.display="none";
}
}
window.onload=function(){
contLista=document.getElementsByTagName("ul")
for(i=0;i<contLista.length;i++){
contLista.item(i).id="lista"+i;
lista=contLista.item(i).getElementsByTagName("li");
for(j=0;j<lista.length;j++)
if(j>=limite_lista) lista.item(j).style.display="none";
var boton=document.createElement("input");
boton.type="button";
boton.value=valb[0];
boton.id="bot"+i;
boton.onclick=function(){op(this.id,this.value)};
document.getElementById("lista"+i).appendChild(boton);
}
}
Autos Ferrari
Autos Lexus
Salu2
![U_U](http://static.forosdelweb.com/fdwtheme/images/smilies/nods.png)