[英]checkbox onclick event loads as if checked
When I load the page both forms are displayed. 当我加载页面时,将同时显示两种形式。 If I check and then uncheck "add" the second form disappears.
如果我选中然后取消选中“添加”,第二种形式就会消失。 How do I make this page load with form 2 hidden on load?
如何在加载隐藏表格2的情况下加载此页面?
<html>
<title>Car Service</title>
<strong>Car Service:</strong><br><br>
<input type="submit" id="accountsearch" name="accountsearch" value="Select Customer" onclick="window.open('selectaccount.php');"><br><br>
<form name="newservicesetup" id="newservicesetup" action="" method="post">
<select name="ordertype" id="ordertype">
<option>(Select Service)</option>
<option value="Service">Service</option>
<option value="ServiceHardware">Service w/ Hardware</option>
</select>
<input type="text" name="qty1" id="qty1" value="Quantity" size="5" onclick="this.value=''">
<input type="checkbox" id="add" value="0" name="add" onclick="
if (this.checked) {
document.getElementById('newservicesetup1').style.display='inline';
} else {
document.getElementById('newservicesetup1').style.display='none'; } return true;" >
</form>
<form name="newservicesetup1" id="newservicesetup1" action="" method="post">
<select name="ordertype1" id="ordertype1">
<option>(Select Service)</option>
<option value="Service">Service</option>
<option value="ServiceHardware">Service w/ Hardware</option>
</select>
<input type="text" name="qty2" id="qty2" value="Quantity" size="5" onclick="this.value=''">
</form>
<br>
XX: <input type="file" name="sfa" id="sfa">
AA1: <input type="file" name="pbxws" id="pbxws"><br> <br>
<input type="submit" name="next" id="next" value="Next">
set the second forms css class to hidden or something like that and then define .hidden in your css to be display:none. 将第二种形式的CSS类设置为hidden或类似的东西,然后在CSS中将.hidden定义为display:none。 Or put style='display:none' t ostart with on the second form
或者将style ='display:none'放在第二个表单上
更改您的第二个表单标签以阅读此内容。
<form name="newservicesetup1" id="newservicesetup1" action="" method="post" style="display:none;">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.