I have a php array which I displaying with a while loop and it gets the data from a sql database, at the moment everything in the array appears instantly, but would it be possible to get them to display with a half second delay? Would i have to use Javascript?
3条回答 默认 最新
- dongzai0020 2014-12-04 12:19关注
You can put a
<div>
around your array, like this:<div id="myElementID" style="display:none;"> MY ARRAY </div>
and it will not be visible. With Javascript you can make it visible after, for instance, a 1000 milliseconds, with:
function showElement(id) // make hidden element visible { document.getElementById(id).style.display = ""; } window.setTimeout("showElement('myElementID')",1000);
No other libraries are needed for this.
If you need to do multiple rows you can wrap a
<div>
around each row, or use the<tr>
tag if your're using tables, like this:<div id="myRow1" style="display:none;"> ROW 1 </div> <div id="myRow2" style="display:none;"> ROW 2 </div> <div id="myRow3" style="display:none;"> ROW 2 </div> ....... <div id="myRowN" style="display:none;"> ROW N </div>
And in your script:
for (i = 1; i <= N; i++) { window.setTimeout("showElement('myRow"+i+"')",500); }
You would still need the
showElement()
function.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 数学建模招标中位数问题
- ¥15 phython路径名过长报错 不知道什么问题
- ¥15 深度学习中模型转换该怎么实现
- ¥15 HLs设计手写数字识别程序编译通不过
- ¥15 Stata外部命令安装问题求帮助!
- ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
- ¥15 TYPCE母转母,插入认方向
- ¥15 如何用python向钉钉机器人发送可以放大的图片?
- ¥15 matlab(相关搜索:紧聚焦)
- ¥15 基于51单片机的厨房煤气泄露检测报警系统设计