有人可以解释一下我在使用 Javascript 显示隐藏的 DIV 时哪里出错了。我已经查看了以前的答案,但它们似乎不起作用。
.newinner
{
display: none;
padding-left: 10px;
padding-top: 10px;
background: white;
width: 905px;
margin: auto;
height: 400px;
}
</style>
<script>
function ShowDiv(newinner)
{
document.getElementsByClassName("newinner").style.display="block";
}
</script>
下面是DIV
<button type="button" name="faddress" value="Show Div" onClick="showDiv('newinner')" />Find Address</button></div>
<div class="newform">
<div class="newinner">
<form>
<div class="formtitle"><b>To request this brochure please fill out the form below.</b></div>
<div class="ntitle"><b>First Name*:</b><br><select>
<option value="title">Title</option>
<option value="mr">Mr</option>
<option value="mrs">Mrs</option>
<option value="miss">Miss</option>
<option value="ms">Ms</option>
</select>
</div>
<div class="fname">
<input type="firstname" name="fname" /></div>
<div class="lname"><b>Last Name:*</b><input type="lastname" name="lname" /></div>
</form>
</div>
</div>