如何在javascript中用另一个div替换div?
这就是我所拥有的:
<div id="main_place">
main
</div>
<button onclick="show(operation1)">Replace to operation 1</button>
<button onclick="show(operation2)">Replace to operation 2</button>
<button onclick="show(operation3)">Replace to operation 3</button>
<div id=operation1 style=“display:none”>
Some textboxes and text
</div>
<div id=operation2 style=“display:none”>
Again some textboxes and text
</div>
<div id=operation3 style=“display:none”>
And again some textboxes and text
</div>
<script>
function show(param_div_id){
document.getElementById('main_place').innerHTML = Here should be div from param;
}
</script>
有没有可能在没有jquery的情况下完成呢?
https://stackoverflow.com/questions/37347690
复制相似问题