比如说有3个DIV,当我点击 下一页的按钮的时候 第一个层要隐藏 第二个层要显示 如此类推..
点击上一页的时候 显示上一个DIV 隐藏当前的DIV
刚学jQuery 求解答!!
$('xxx').show().siblings().hide();
xxx就负责找到要显示的那个
$("div").hide(); //隐藏所有的Div
$("div").eq(n).show(); //显示你想要的那个 n以0开始。
在命名上做文章。比如三个div分别叫做:divstep1、divstep2、divstep3 。为button增加onclick事件 nextstep();
//定义当前步骤:
var curr =null;
$(function(){
$("div[id*='divstep']").hide();
});
function nextStep()
{
if(curr!=null)
{
$('divstep'+curr.ToString()).hide();
curr=NuMber(curr)++;
$('divstep'+curr.toString()).show();
}else{
$('divstep1').show();
curr=1;
}
}