Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/04/2010, 13:53
supertux3000
 
Fecha de Ingreso: abril-2010
Mensajes: 4
Antigüedad: 14 años
Puntos: 0
Pregunta Cambiar de Css

Hola amigos del foro pues aqui con un problema tengo que hacer que cuando el usuario precione un boton se le cambie el css Ejemplo:

Boton cambio uno va directo al Css1

Código HTML:
Ver original
  1.     <title>Cambiar de Css con un click</title>
  2.     <!--Asi se agrega un script de tipo javascript al documento -->
  3.     <link rel="stylesheet" type="text/css" id="estilo"  href="archivo1.css" />
  4.     <link rel="stylesheet" type="text/css" id="estilo" href="archivo2.css" />
  5.     <link rel="stylesheet" type="text/css" id="estilo" href="archivo3.css" />
  6.     <link rel="stylesheet" type="text/css" id="estilo" href="archivo4.css" />
  7.    
  8.     <script type="text/javascript">
  9.    
  10.         function estilo()
  11.     {
  12.  
  13.         document.getElementById('estilo').sref=archivo1.css;
  14.     }
  15.     </script>
  16. </head>
  17.    
  18.  
  19.         <input type="button" value="Cambiar Estilo" onClick="estilo('archivo1.css');">
  20.         <input type="button" value="Cambiar Estilo" onClick="estilo('archivo2.css');">
  21.         <input type="button" value="Cambiar Estilo" onClick="estilo('archivo3.css');">
  22.  
  23. <h1>Hola mundo </h1>
  24.  
  25. <h2>Hola mundo </h2>
  26.  
  27. <h3>Hola mundo </h3>
  28. </body>
  29.  
  30. </html>

No se que estoy haciendo mal ojala me puedan ayudar grax