如何使用文本表单的 id 更改隐藏表单的值?我有以下内容:
<form name="form" action="file.php" method="post">
<input type="hidden" name="dessert" id="dessert" value="">
Favorite cake: <input type="text" name="cake" id="cake" onfocus="dessert.value=this.id"><br>
Favorite pie: <input type="text" name="pie" id="pie" onfocus="dessert.value=this.id"><br>
Favorite taffy: <input type="text" name="taffy" id="taffy" onfocus="dessert.value=this.id"><br>
<input type="submit value="Go."><br>
我对 html 很不熟悉,所以我无法使用文本输入 onfocus 的 id 更改隐藏表单的值。