#step2 和 #step2h 的 css 是可见性的:hidden 这是我当前的脚本,但我不仅想显示#step,而且还想用 JavaScript 一键显示#step2h。
<body>
<center>
<div id="header"></div>
<div id="wrapper">
<div id="content">
<div id="contenth">
<h1 id=>content header</h1>
</div>
content
<a href="#" onclick="changeDiv(1)">Menu 1</a> ///change to other div
<a href="#" onclick="changeDiv(2)">Menu 2</a>
<script>
function changeDiv(i){
if(i==1)
document.getElementById("content").innerHTML = document.getElementById("step2").innerHTML;
else
document.getElementById("step2").innerHTML = document.getElementById("content").innerHTML;
}
</script>
</div>
</div>
<div id="step2"> // Showed on click
<div id="step2h">//want to show this as well
<h1>STEP 2 Header</h1>
</div>
<h2>Step 2 Content</h2>
</div>
</center>
</body>