象这样的轮换图片 怎么才能从数据库中读出来 都需要在哪加循环语句

lishuai818 2008-11-25 05:11:14
搞了一下午也没弄明白 快下班了 求大家帮忙
下面的代码我要怎么加循环语句才能把数据库里的图片读出来 谢谢 在线等
<style>
BODY {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12px; BACKGROUND: #000; PADDING-BOTTOM: 0px; MARGIN-LEFT: auto; COLOR: #f6f6ee; MARGIN-RIGHT: auto; PADDING-TOP: 0px; FONT-FAMILY: 宋体; HEIGHT: 490px; TEXT-ALIGN: center
}
A {
COLOR: #fff; TEXT-DECORATION: none
}
A:hover {
COLOR: #fff; TEXT-DECORATION: underline
}
.fpic {
BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; Z-INDEX: 3; BACKGROUND: #000; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 476px; POSITION: relative; HEIGHT: 330px; BORDER-RIGHT-WIDTH: 0px;BORDER: #dddddd 1px solid;
text-align:center
}
.bpic {
FLOAT: left; MARGIN: 0px; WIDTH: 244px; POSITION: relative; HEIGHT: 243px
}
#focpic {
BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; LEFT: 1px; BORDER-BOTTOM-WIDTH: 0px; POSITION: absolute; TOP: 1px; BORDER-RIGHT-WIDTH: 0px
}
.thubpic {
PADDING-RIGHT: 0px; PADDING-LEFT: 4px; Z-INDEX: 20; PADDING-BOTTOM: 0px; WIDTH: 63px; CURSOR: pointer; PADDING-TOP: 4px; TOP: 10px; HEIGHT: 49px
}
.thubpiccur {
PADDING-RIGHT: 0px; PADDING-LEFT: 4px; Z-INDEX: 20; PADDING-BOTTOM: 0px; WIDTH: 63px; CURSOR: pointer; PADDING-TOP: 4px; TOP: 10px; HEIGHT: 49px
}
.thubpiccur {
Z-INDEX: 30; BACKGROUND: url(icon/images20071220/arrow3.gif) no-repeat left 50%
}
.thubpic IMG {
BORDER-RIGHT: #666 3px solid; BORDER-TOP: #666 2px solid; BORDER-LEFT: #666 3px solid; WIDTH: 56px; BORDER-BOTTOM: #666 2px solid; HEIGHT: 42px
}
.thubpiccur IMG {
BORDER-RIGHT: #666 3px solid; BORDER-TOP: #666 2px solid; BORDER-LEFT: #666 3px solid; WIDTH: 56px; BORDER-BOTTOM: #666 2px solid; HEIGHT: 42px
}
.thubpiccur IMG {
BORDER-LEFT-COLOR: #fff; BORDER-BOTTOM-COLOR: #fff; BORDER-TOP-COLOR: #fff; BORDER-RIGHT-COLOR: #fff
}
-->
</style>
<SCRIPT language=javascript>
//all by www.qpsh.com
var currslid = 0;
var slidint;
function setfoc(id){
document.getElementById("focpic").src = picarry[id];
document.getElementById("foclnk").href = lnkarry[id];
document.getElementById("fttltxt").innerHTML = '<a href="'+lnkarry[id]+'" target="_blank">'+ttlarry[id]+'</a>';
currslid = id;
for(i=0;i<6;i++){
document.getElementById("tmb"+i).className = "thubpic";
};
document.getElementById("tmb"+id).className ="thubpiccur";
focpic.style.visibility = "hidden";
focpic.filters[0].Apply();
if (focpic.style.visibility == "visible") {
focpic.style.visibility = "hidden";
focpic.filters.revealTrans.transition=23;
}
else {
focpic.style.visibility = "visible";
focpic.filters[0].transition=23;
}
focpic.filters[0].Play();
stopit();
}

function playnext(){
if(currslid==5){
currslid = 0;
}
else{
currslid++;
};
setfoc(currslid);
playit();
}
function playit(){
slidint = setTimeout(playnext,4500);
}
function stopit(){
clearTimeout(slidint);
}
window.onload = function(){
playit();
}
</SCRIPT>
</head>

<body>
<DIV class=fpic>
<A id=foclnk href="http://www.qpsh.com/" target=_blank><IMG id=focpic style="FILTER: RevealTrans ( duration = 1,transition=23 ); VISIBILITY: visible; POSITION: absolute" height=300 alt="" src="icon/images20071220/01.jpg" width=400></A>
<DIV id=fttltxt
style="MARGIN-TOP: 305px; FLOAT: left; WIDTH: 400px; TEXT-ALIGN: center"><A
href="http://www.qpsh.com/" target=_blank>梦:牧场小屋</A></DIV>
<DIV style="MARGIN-LEFT: 402px; WIDTH: 65px">
<DIV class=thubpiccur id=tmb0 onmouseover=setfoc(0); onmouseout=playit();><A
href="http://www.qpsh.com/" target=_blank><IMG
src="icon/images20071220/01.jpg" alt="" width=56 height=42 border="0"></A></DIV>
<DIV class=thubpic id=tmb1 onmouseover=setfoc(1); onmouseout=playit();><A
href="http://www.qpsh.com/" target=_blank><IMG height=45 alt=""
src="icon/images20071220/02.jpg" width=56></A></DIV>
<DIV class=thubpic id=tmb2 onmouseover=setfoc(2); onmouseout=playit();><A
href="http://www.qpsh.com/" target=_blank><IMG height=45 alt=""
src="icon/images20071220/03.jpg" width=56></A></DIV>
<DIV class=thubpic id=tmb3 onmouseover=setfoc(3); onmouseout=playit();><A
href="http://www.qpsh.com/" target=_blank><IMG height=45 alt=""
src="icon/images20071220/04.jpg" width=56></A></DIV>
<DIV class=thubpic id=tmb4 onmouseover=setfoc(4); onmouseout=playit();><A
href="http://www.qpsh.com/" target=_blank><IMG height=45 alt=""
src="icon/images20071220/05.jpg" width=56></A></DIV>
<DIV class=thubpic id=tmb5 onmouseover=setfoc(5); onmouseout=playit();><A
href="http://www.qpsh.com/" target=_blank><IMG height=45 alt=""
src="icon/images20071220/06.jpg" width=56></A></DIV>
<SCRIPT language=javascript type=text/javascript>
var picarry = {};
var lnkarry = {};
var ttlarry = {};
picarry[0] = "icon/images20071220/01.jpg";
lnkarry[0] = "http://www.qpsh.com/";
ttlarry[0] = "梦:牧场小屋";
picarry[1] = "icon/images20071220/02.jpg";
lnkarry[1] = "http://www.qpsh.com/";
ttlarry[1] = "碎玉:回眸";
picarry[2] = "icon/images20071220/03.jpg";
lnkarry[2] = "http://www.qpsh.com/";
ttlarry[2] = "飞狐:豆花档";
picarry[3] = "icon/images20071220/04.jpg";
lnkarry[3] = "http://www.qpsh.com/";
ttlarry[3] = "牛说不哭:烈日下的建筑工人";
picarry[4] = "icon/images20071220/05.jpg";
lnkarry[4] = "http://www.qpsh.com/";
ttlarry[4] = "新疆瓦格:哈萨克族搭建毡房";
picarry[5] = "icon/images20071220/06.jpg";
lnkarry[5] = "http://www.qpsh.com/";
ttlarry[5] = "松间明月:汽车文化";
</SCRIPT>
</DIV></DIV>

效果http://www.qpsh.com/showjs.asp

拜托了
...全文
142 1 收藏 20
写回复
20 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
iloveyou1988111 2010-06-02
我一直在先等着;希望你们帮帮我。谢谢!
回复
iloveyou1988111 2010-06-02
请问,我怎么把这里面的图片(jpg形式的)换进去啊?怎么总也弄不进去?急需;帮帮忙啊,谢谢
回复
hebhd 2008-11-25

<%

set rsz=server.createobject("adodb.recordset")
sql="select top 6 * from gjrz order by id desc"
'----------这里要只读6条记录
rsz.open sql,conn,1,1
linkurl=rsz("linkurl")
imgs=rsz("imgs")
%>

<DIV class=fpic>
<A id=foclnk href=" <%=rsz("linkurl")%>" target=_blank> <IMG id=focpic style="FILTER: RevealTrans ( duration = 1,transition=23 ); VISIBILITY: visible; POSITION: absolute" height=300 alt="" src=" <%=rsz("imgs")%>" width=400> </A>

<DIV style="MARGIN-LEFT: 402px; WIDTH: 65px">
<%For i=1 to rsz.RecordCount%>
<DIV class=thubpiccur id="tmb"&i onmouseover=setfoc(i); onmouseout=playit();> <A
href=" <%=rsz("linkurl")%>" target=_blank> <IMG
src=" <%=rsz("imgs")%>" alt="" width=56 height=42 border="0"> </A> </DIV>
<%
rsz.MoveNext
Next
%>
<SCRIPT language=javascript type=text/javascript>
var picarry = {};
var lnkarry = {};
var ttlarry = {};
<%
rsz.movefirst
do while not rsz.eof
i = 0
%>
picarry[<%=i%>] = "<%=rsz("imgs1")%>";
lnkarry[<%=i%>] = "<%=rsz("linkurl")%>";
ttlarry[<%=i%>] = "<%=rsz("title")%>";
<%
i = i+1

rsz.movenext
loop
%>
</SCRIPT>
</DIV>

</DIV>




如果还有问题.请确认你的css及js都已经加入到本页.并且不会产生变量冲突
回复
lishuai818 2008-11-25
贴出来了 没人吗
回复
lishuai818 2008-11-25
<%

set rsz=server.createobject("adodb.recordset")
sql="select * from gjrz order by id desc"
rsz.open sql,conn,1,1
linkurl=rsz("linkurl")
imgs=rsz("imgs")
%>

<DIV class=fpic>
<A id=foclnk href="<%=rsz("linkurl")%>" target=_blank> <IMG id=focpic style="FILTER: RevealTrans ( duration = 1,transition=23 ); VISIBILITY: visible; POSITION: absolute" height=300 alt="" src="<%=rsz("imgs")%>" width=400> </A>

<DIV style="MARGIN-LEFT: 402px; WIDTH: 65px">
<%For i=1 to rsz.RecordCount%>
<DIV class=thubpiccur id="tmb"&i onmouseover=setfoc(i); onmouseout=playit();> <A
href="<%=rsz("linkurl")%>" target=_blank> <IMG
src="<%=rsz("imgs")%>" alt="" width=56 height=42 border="0"> </A> </DIV>
<%
rsz.MoveNext
Next
%>
<SCRIPT language=javascript type=text/javascript>
var picarry = {};
var lnkarry = {};
var ttlarry = {};
<%
rsz.movefirst
do while not rsz.eof
i = 0
%>
picarry[ <%=i%>] = "<%=rsz("imgs1")%>";
lnkarry[ <%=i%>] = "<%=rsz("linkurl")%>";
ttlarry[ <%=i%>] "<%=rsz("title")%>"onload ;
<%
i = i+1

rsz.movenext
loop
%>
</SCRIPT>
</DIV>

</DIV>

这是我的代码 能出来 但没有他那种动的效果
回复
box283 2008-11-25
<%
do while not rs.eof
%>

<a href="#"> <%=rs("数据库中的图片")%></a>
<%
rs.movenext
if rs.eof then exit do
loop
%>
回复
hebhd 2008-11-25
人家已经给你写的很清楚了..

你的新闻的top 6 是怎么出来的.你需要提供代码.

athenna
已经给你写的很清楚了.你要将你自已的源码.

在哪里使用.对应的数据库字段.

光在这里叫没用的
回复
lishuai818 2008-11-25
修改一下 看效果的地址 http://www.qpsh.com/javascript/showpage2526.htm
回复
lishuai818 2008-11-25
http://www.qpsh.com/javascript/showpage2526.htm 运行这个就能看到了
回复
街头小贩 2008-11-25
缺少参数!什么效果呀!
回复
lishuai818 2008-11-25
自己顶一下
回复
lishuai818 2008-11-25
没人吗?
回复
lishuai818 2008-11-25
主要就是想把那个效果循环出来 所以不知道怎么循环 您可以先看下那的效果 然后在看代码就明白我的意思了
回复
情绝书生 2008-11-25
把修改后的代码发上来
回复
草原可可 2008-11-25
太多了 把ASP代码贴出来
回复
lishuai818 2008-11-25
帮帮忙了 做不完回不去家了
回复
lishuai818 2008-11-25
好象不行啊
回复
情绝书生 2008-11-25
delete
回复
lishuai818 2008-11-25
<DIV class=fpic>
<A id=foclnk href="http://www.qpsh.com/" target=_blank> <IMG id=focpic style="FILTER: RevealTrans ( duration = 1,transition=23 ); VISIBILITY: visible; POSITION: absolute" height=300 alt="" src="icon/images20071220/01.jpg" width=400> </A>
<DIV id=fttltxt
style="MARGIN-TOP: 305px; FLOAT: left; WIDTH: 400px; TEXT-ALIGN: center"> <A
href="http://www.qpsh.com/" target=_blank>梦:牧场小屋 </A> </DIV>
<DIV style="MARGIN-LEFT: 402px; WIDTH: 65px">
<DIV class=thubpiccur id=tmb0 onmouseover=setfoc(0); onmouseout=playit();> <A
href="http://www.qpsh.com/" target=_blank> <IMG
src="icon/images20071220/01.jpg" alt="" width=56 height=42 border="0"> </A> </DIV>
<DIV class=thubpic id=tmb1 onmouseover=setfoc(1); onmouseout=playit();> <A
href="http://www.qpsh.com/" target=_blank> <IMG height=45 alt=""
src="icon/images20071220/02.jpg" width=56> </A> </DIV>
<DIV class=thubpic id=tmb2 onmouseover=setfoc(2); onmouseout=playit();> <A
href="http://www.qpsh.com/" target=_blank> <IMG height=45 alt=""
src="icon/images20071220/03.jpg" width=56> </A> </DIV>
<DIV class=thubpic id=tmb3 onmouseover=setfoc(3); onmouseout=playit();> <A
href="http://www.qpsh.com/" target=_blank> <IMG height=45 alt=""
src="icon/images20071220/04.jpg" width=56> </A> </DIV>
<DIV class=thubpic id=tmb4 onmouseover=setfoc(4); onmouseout=playit();> <A
href="http://www.qpsh.com/" target=_blank> <IMG height=45 alt=""
src="icon/images20071220/05.jpg" width=56> </A> </DIV>
<DIV class=thubpic id=tmb5 onmouseover=setfoc(5); onmouseout=playit();> <A
href="http://www.qpsh.com/" target=_blank> <IMG height=45 alt=""
src="icon/images20071220/06.jpg" width=56> </A> </DIV>
楼上大哥 那这些应该怎么办?
回复
情绝书生 2008-11-25
<SCRIPT language=javascript type=text/javascript>
var picarry = {};
var lnkarry = {};
var ttlarry = {};
<%
do while not rs.eof
i = 0
%>
picarry[<%=i%>] = "<%=Rs("数据库字段")%>";
lnkarry[<%=i%>] = "<%=Rs("数据库字段")%>";
ttlarry[<%=i%>] "<%=Rs("数据库字段")%>";
<%
i = i+1
rs.movenext
wend
%>
</SCRIPT>
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-11-25 05:11
社区公告
暂无公告