So I am trying to create a select menu for changing the size of an image but I have no idea whats wrong with this piece of code or how to fix it.
HTML:
<img id="dogpicture" src="dog1.png" alt="dog" height="150" width="150"></img>
<select id="dogsize" name="sizeofdog" onchange="dogsize(this.value);">
<option value="small"> small </option>
<option value="default" selected> default </option>
<option value="big"> big </option>
</select>
JS:
function dogsize(option){
if (option == "small"){
document.getElementById('dogpicture').height = "50";
document.getElementById('dogpicture').width = "50";
}
if (option == "default"){
document.getElementById('dogpicture').height = "100";
document.getElementById('dogpicture').width = "100";
}
if (option == "big"){
document.getElementById('dogpicture').height = "150";
document.getElementById('dogpicture').width = "150";
}
}
". Or addpxat the end, if you are gonna send as strings.