0
Good afternoon, I am in need of a help, I need to select the value of the choice of a select and call a different link to value, by clicking the button.
<div>
<button onclick="redirecionar()">COMPRAR</button>
<select id="cor">
<option value="1">BRANCO</option>
<option value="2">PRETO</option>
<option value="3">VERDE</option>
</select>
<script>
var valor = document.getElementById('cor');
function redirecionar() {
window.location.href = "http://www.google.com";
}
if (valor == "2") {
window.location.href = "http://www.facebook.com.br";
}
if (valor == "3") {
window.location.href = "http://www.youtube.com.br";
}
}
</script>
</div>