轮播图片代码是这样的一个形式:
<div style="display:" id="der0"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/1.jpg" width="800" height="560" border="0" /></a></div>
<div style="display:none" id="der1"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/2.jpg" width="800" height="560" border="0" /></a></div><div style="display:none" id="der2"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/3.jpg" width="800" height="560" border="0" /></a></div><div style="display:none" id="der3"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/4.jpg" width="800" height="560" border="0" /></a></div><div style="display:none" id="der4"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/5.jpg" width="800" height="560" border="0" /></a></div>因为第一个display和以后的都不一样,那么第一个应该不参与循环吧,想用while($row = $result->fetch_row()){ *循环代码 }这样的方式循环,该怎么办呢……有啥能跳一个再循环的方法呢
<div style="display:" id="der0"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/1.jpg" width="800" height="560" border="0" /></a></div>
<div style="display:none" id="der1"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/2.jpg" width="800" height="560" border="0" /></a></div><div style="display:none" id="der2"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/3.jpg" width="800" height="560" border="0" /></a></div><div style="display:none" id="der3"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/4.jpg" width="800" height="560" border="0" /></a></div><div style="display:none" id="der4"><a href="javascript:history.back()" style="cursor:pointer;" target="_parent"><img src="images/5.jpg" width="800" height="560" border="0" /></a></div>因为第一个display和以后的都不一样,那么第一个应该不参与循环吧,想用while($row = $result->fetch_row()){ *循环代码 }这样的方式循环,该怎么办呢……有啥能跳一个再循环的方法呢
解决方案 »
- *************************************GLPI中导出文件中文乱码的问题***************************
- PHP 乱码
- 请教一下imagecreate 这个函数是不是不支持php5呢
- 为什么我不能限定和读取 ZIP 和 RAR 的 MIME 类型, 连最下边的 ECHO 输出也不能 !?
- php怎么定义16位的整型,2个字节
- php+mysql的安装与配置
- 新手提问?乱码问题。
- 怎麼把 $_POST[] 中的內容全部輸出來檢查?
- PHP调用C#Webservice传数组参数的问题
- PHP操作MYSQL时数据被重复计算
- php 验证码生成图片无法显示
- 求编程。。。
最直接的方法 在while循环内做个判断就可以了
$i=0;
while(con)
{
if($i==0)
//不显示的样式
else
//显示的样式
$i++;
}
$i=0;
while($rs=$db->fetch_array($query))
{
$display=$i==0?"block":"none";
echo "<div id=der{$i} style='display:$display'></div>";
$i++;
}