01
<title>林虹彤程式設計</title>
<script>
const McDonald = ['🍔', '🍟', '🍕', '🌭', '🥪', '🍿'];
function compute()
{
var food = document.getElementById("food");
document.getElementById("out").innerHTML = "<font size=7>".concat(McDonald[food.selectedIndex],"</font>");
}
</script>
<h1>下拉式選單</h1>
<select id="food">
<option selected>🍔漢堡</option>
<option>🍟薯條</option>
<option>🍕披薩</option>
<option>🌭熱狗</option>
<option>🥪三明治</option>
<option>🍿爆米花</option>
</select>
<input onclick="compute()" type="button" value="送上餐點" />
<p id="out"></p>
留言
張貼留言