我们需要在并排视图中显示两个不同的数据。双方观点完全相同,只是数据不同。
如何使用javascript以更好的方式实现这一点?有可用的可恢复插件吗?
任何人请告知。
<pre> <html>
<head>
<script>
function show(shown, hidden) {
document.getElementById(shown).style.display='block';
document.getElementById(hidden).style.display='none';
return false;
}
</script>
</head>
<body>
<div id="Page1">
Content of page 1
<a href="#" onclick="return show('Page2','Page1');">Show page 2</a>
</div>
<div id="Page2" style="display:none">
Content of page 2
<a href="#" onclick="return show('Page1','Page2');">Show page 1</a>
</div>
</body>
</html>