我在这里有一个相对简单的问题。最简单的方法来按按钮点击加载DIV?
我需要的是这个;我需要有一个页面,顶部有5个按钮,下面有一个DIV(最初隐藏)。当点击一个按钮时,它将内容加载到DIV中(以另一个DIV的形式)
例如。
[Button 1] [Button 2] [Button 3] [Button 4] [Button 5] //5 buttons or links
<div id="content">
// area for content to be loaded
</div>
<div id="content1">
//could be a table or image
</div>
<div id="content2">
//could be a table or image
</div>
<div id="content3">
//could be a table or image
</div>
<div id="content4">
//could be a table or image
</div>
<div id="content5">
//could be a table or image
</div>
在上面的例子中,当用户加载页面时,他们看到5个按钮。如果他们按下按钮5,则会在“content”DIV内加载“content5”DIV,例如。
<div id="content">
<div id="content5">
</div>
</div>
如果选择了另一个按钮,它会加载它的内容。
可以用jQuery或简单的JavaScript来实现。
非常感谢
您是否希望以前按钮点击的内容保留在#内容中? – ocodo 2011-02-03 07:14:11