I can't figure out where I'm going wrong - when "Europe" is selected nothing happens.
When I take away the if statement it works, so the output code is definitely okay. The problem seems to be with the if condition.
<script> function shipping_calc() {
var val = document.getElementById.("country").value;
if (val === "Europe")
{
document.getElementById("output").innerHTML = "£2.40";
}
}
</script>
<select id="country" onchange="shipping_calc()">
<option value="United Kingdom">United Kingdom</option>
<option value="Europe">Europe</option>
<option value="Worldwide">Worldwide</option>
</select>
<p id="output"></p>
Aucun commentaire:
Enregistrer un commentaire