ho creato questo script sulla base di quello che ho imparato nel precedente post ma.....
codice:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<a id="object" class="obclass" href="http://www.link1.html"></a>
<button onclick="toggle()"><h3>clicca</h3></button>
<style>
.obclass{
width:300px;
height:300px;
background-image: url();
background-color: rgb(0, 0, 0);
background-repeat: no-repeat;
background-attachment: scroll;
position:absolute;
}
button{
top:310px;
position:absolute;
}
</style>
<script>
function toggle() {
var object=document.getElementById("object");
if (object.className="obclass"){object.href="http://www.link2.html"}
else if (object.className="obclass"){object.href="http://www.link3.html"}
else if (object.className="obclass"){object.href="http://www.link4.html"}
}
</script>
</body>
</html>
si blocca al "link2"
...non capisco come andare avanti, cosa ho sbagliato?