jquery 循环显示div的示例代码
时间:2021-07-11 08:43:40|栏目:jquery|点击: 次
直接看例子
for(var p=1; p<=5; p++){
$("#properties"+p).show();
//下面有五个id为properties1 、properties2 、properties3 、properties4、properties5的div
//我们用一个语句就让下面五个div显示成功了。
}
}
<div class="banner" id="properties1">
<span>【${property1 }】</span>
<div id="property1" class="bannerchild"></div>
</div>
<div class="banner" id="properties2">
<span>【${property2 }】</span>
<div id="property2" class="bannerchild"></div>
</div>
<div class="banner" id="properties3">
<span>【${property3 }】</span>
<div id="property3" class="bannerchild"></div>
</div>
<div class="banner" id="properties4">
<span>【${property4 }】</span>
<div id="property4" class="bannerchild"></div>
</div>
<div class="banner" id="properties5">
<span>【${property5 }】</span>
<div id="property5" class="bannerchild"></div>
</div>
复制代码 代码如下:
for(var p=1; p<=5; p++){
$("#properties"+p).show();
//下面有五个id为properties1 、properties2 、properties3 、properties4、properties5的div
//我们用一个语句就让下面五个div显示成功了。
}
}
<div class="banner" id="properties1">
<span>【${property1 }】</span>
<div id="property1" class="bannerchild"></div>
</div>
<div class="banner" id="properties2">
<span>【${property2 }】</span>
<div id="property2" class="bannerchild"></div>
</div>
<div class="banner" id="properties3">
<span>【${property3 }】</span>
<div id="property3" class="bannerchild"></div>
</div>
<div class="banner" id="properties4">
<span>【${property4 }】</span>
<div id="property4" class="bannerchild"></div>
</div>
<div class="banner" id="properties5">
<span>【${property5 }】</span>
<div id="property5" class="bannerchild"></div>
</div>
上一篇:jQuey将序列化对象在前台显示地实现代码(方法总结)
栏 目:jquery
本文标题:jquery 循环显示div的示例代码
本文地址:http://www.codeinn.net/misctech/155956.html