ドロップダウンメニューを使用して、ボディの背景画像(id = "shelf")を変更しようとしています。
<script type="text/javascript">
function changeTheme()
{document.getElementById("shelf").style.backgroundImage = "url("+theme+")";
var e = document.getElementById("themes");
var theme = e.options[e.selectedIndex].value;
}
</script>
</head>
<body id="shelf">
<select id="themes" onChange="changeTheme()">
<option value="images/bg/default.png">Default</option>
<option value="images/bg/oriental.png">Oriental</option>
<option value="images/bg/office.png">Office</option>
<option value="images/bg/old.png">Old</option>
</select>
</body>
しかし、なぜそれが機能しないのかわかりません。コードの問題はどこにありますか?