当用户从我的列表框中选择一个选项时,我需要知道如何执行脚本。我当前的代码(尽管这可能是错误的方法是:
<form>
Character Name: <input type="text" name="charname">
</form>
Server Region: <select id="serverloc">
<option value="4">US</option>
<option value="Oceanic">Oceanic</option>
</select>
<script>
var serverloc = document.getElementById(4);
if ( serverloc == "Oceanic" ) {
document.Write("it Worked!")
}
</script>