CSS - Multicss

 
Vista:

Multicss

Publicado por Omar (1 intervención) el 13/04/2010 12:07:31
Hola amigos del foro tengo un mega problema no encuentro que hice mal en mi pagina lo que quiero es que cuando el usuario precione un boton se le cambie el css por favori si alguien me dice por favori en que me equvoque de mi codigo ojala me puedan ayudar gracias.

[HIGHLIGHT="HTML"]

<html>
<head>
<title>Cambiar de Css con un click</title>
<!--Asi se agrega un script de tipo javascript al documento -->
<link rel="stylesheet" type="text/css" id="estilo" href="archivo1.css" />
<link rel="stylesheet" type="text/css" id="estilo" href="archivo2.css" />
<link rel="stylesheet" type="text/css" id="estilo" href="archivo3.css" />
<link rel="stylesheet" type="text/css" id="estilo" href="archivo4.css" />

<script type="text/javascript">

function estilo()
{

document.getElementById('estilo').sref=archivo1.css;
}
</script>
</head>
<body>


<input type="button" value="Cambiar Estilo" onClick="estilo('archivo1.css');">
<input type="button" value="Cambiar Estilo" onClick="estilo('archivo2.css');">
<input type="button" value="Cambiar Estilo" onClick="estilo('archivo3.css');">

<h1>Hola mundo </h1>

<h2>Hola mundo </h2>

<h3>Hola mundo </h3>
</body>

</html>
[/HIGHLIGHT]
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de iBet7o

RE:Multicss

Publicado por iBet7o (3 intervenciones) el 20/04/2010 20:55:16
Prueba con esto.

Saludos!!

<html>
<head>
<title>Cambiar de Css con un click</title>
<!--Asi se agrega un script de tipo javascript al documento -->
<link rel="stylesheet" type="text/css" id="estilo" href="archivo1.css" />
<script type="text/javascript">
function estilo(archivoCss)
{
alert(document.getElementById('estilo').href);
document.getElementById('estilo').href = archivoCss;
}
</script>
</head>
<body>
<input type="button" value="Cambiar Estilo 1" onClick="estilo('archivo1.css');">
<input type="button" value="Cambiar Estilo 2" onClick="estilo('archivo2.css');">
<input type="button" value="Cambiar Estilo 3" onClick="estilo('archivo3.css');">
<h1>Hola mundo </h1>
<h2>Hola mundo </h2>
<h3>Hola mundo </h3>
</body>
</html>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar