Javascript 在html的另一页上显示下拉列表中的选定值以及其他表单值
我试图显示输入的表单值,包括在另一页的下拉列表中选择的任何选项。如果在下一页上显示下拉列表的代码没有被删除,那么下一页就不会显示任何提交的表单值。但如果删除了该代码,则会显示所有表单值 在显示所选下拉列表值以及表单中提交的任何其他内容方面,我无法确定我在这里哪里出错 下拉列表所在窗体的一部分Javascript 在html的另一页上显示下拉列表中的选定值以及其他表单值,javascript,html,Javascript,Html,我试图显示输入的表单值,包括在另一页的下拉列表中选择的任何选项。如果在下一页上显示下拉列表的代码没有被删除,那么下一页就不会显示任何提交的表单值。但如果删除了该代码,则会显示所有表单值 在显示所选下拉列表值以及表单中提交的任何其他内容方面,我无法确定我在这里哪里出错 下拉列表所在窗体的一部分 <label for="product_interests"><b>Product interests</b></label>
<label for="product_interests"><b>Product interests</b></label>
<select type="text" placeholder="Enter product interests" name="product_interests" id="product_interests" required>
<br></br>
<option value="undecided">Undecided</option>
<option value="french_toast_and_bacon">French toast and bacon</option>
<option value="lamingtons">Lamingtons</option>
<option value="home_styles_soup_of_the_day">Home styles soup of the day</option>
<option value="cheeseburger">Cheeseburger</option>
<option value="sun_and_moon_sandwich">Sun and moon sandwich</option>
<option value="bacon_turnovers">Bacon turnovers</option>
<option value="fettucine_alfredo_pasta">Fettucine alfredo pasta</option>
<option value="crispy_skinned_barramundi">crispy skinned barramundi</option>
<option value="lamb_cuttlets">Lamb cuttlets</option>
</select>
<label>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</label>
<p>By subscribing to our newsletter you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<input type="submit" value="Submit" onclick="submitForm()">
</div>
</div>
下一页上的值应该显示在哪里
<div id="fname">
</div>
<div id="lname">
</div>
<div id="email">
</div>
<div id="birthday">
</div>
<div id="product_interests">
</div>
</body>
重复提交没有意义。您已经在这里执行了-
document.getElementById(“表单”).submit()代码>。这没有改变任何事情。
<div id="fname">
</div>
<div id="lname">
</div>
<div id="email">
</div>
<div id="birthday">
</div>
<div id="product_interests">
</div>
</body>
function setData(){
if(typeof(localStorage) != "undefined"){
document.getElementById("fname").innerHTML = "First name: " + localStorage.fname;
document.getElementById("lname").innerHTML = "Last name: " + localStorage.lname;
document.getElementById("email").innerHTML = "Email: " + localStorage.email;
document.getElementById("birthday").innerHTML = "Birthday: " + localStorage.birthday;
document.getElementById("product_interests"). = "Product interests: " + localStorage.product_interests;
/*if(typeof(localStorage) == "undefined"){
document.getElementById("product_interests").innerHTML = "Product interests: " + localStorage.product_interests;
}*/
}