Hi,
i have this code below. When it is loaded it shows a link with the text “Estado 1”. When you click it, it should be replaced by another link with the text “Estado 2”. When you click on “Estado 2” the link “Estado 1” should appear again and so on…
<script type="text/javascript">
function cambio(){
var capa = document.getElementById("estado1");
if (capa.id == "estado1")
{
capa.innerHTML = <a href="#" onclick="cambio()">Estado 2</a>;
capa.id = "estado2";
}
else{
capa.innerHTML = <a href="#" onclick="cambio()">Estado 1</a>;
capa.id = "estado1";
}
//capa.innerHTML= (capa.style.display == "none") ? "block" : "none";
}
</script>
</head>
<body>
<div>
<div id="estado1">
<a href="#" onclick="cambio()">Estado 1</a>
</div>
</div>
My problem: after clicking “Estado 1” the sentence “Estado 2” is showed, but not as a link but as plain text…
Javi