| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 553 人关注过本帖
标题:想加图片标题
只看楼主 加入收藏
kuizhe425
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2007-5-9
收藏
 问题点数:0 回复次数:0 
想加图片标题

图片新闻:从数据库中读取图片一幻灯片的方式显示。但我想图片下面加标题。图片和标题都循环,不知道该怎么做?

大家帮帮忙!谢谢!

<script language=javascript>
isns = navigator.appName == "Netscape";
function ztstr(id,picurl,linkurl)
{
this.id=id
this.picurl=picurl
this.linkurl=linkurl
}
zhuanti=new Array()
imgcount=1;
frequency=5*1000;//30秒//在这里修改图片的路径和链接
<%dim i
sql="select top 3 Conews.* from Conews where passed<>0 and Elite<>0 and modid='014' and IncludePic<>0 order by Articleid desc"
OpenRS rs,sql,1,1
if not rs.eof then
rs.movefirst
do while not rs.eof
%>
zhuanti[imgcount]=new ztstr(imgcount,'../News/<%=rs("DefaultPicUrl")%>','../News/NewsInfo.asp?id=<%=rs("Articleid")%>&modid=014')
imgcount+=1;

<%
rs.movenext
loop
else
%>
zhuanti[imgcount]=new ztstr(imgcount,'../Image/Imgqxe6/nopic.jpg','#')
<%
end if
rs.close
set rs=nothing
%>
imgcount=zhuanti.length-1
for(i=1;i<=imgcount;i++)
{
eval("img"+i+"=new Image()");
eval("img"+i+".src=zhuanti["+i+"].picurl")
}

nn=1;
var rand1 = 0;
var useRand = 0;
function swapPic() {
var imgnum = zhuanti.length - 1;
do {
var randnum = Math.random();
rand1 = Math.round((imgnum - 1) * randnum) + 1;
} while (rand1 == useRand);
useRand = rand1;
// alert(useRand);
nn=useRand;
change_img();
}
function change_img()
{
eval('document.pic.src=img'+nn+'.src');
nn++;
if(nn>imgcount) nn=1
if(!isns)
{
pic.filters.item(0).apply()
pic.style.visibility='visible'
pic.filters.item(0).play()
setTimeout("pic.style.visibility='hidden'",frequency);
}
else
document.pic.visibility='visible'
tt=setTimeout('change_img()',frequency)
}


function pictarget()
{
tt=nn-1
if(tt<1) tt=imgcount
cururl=zhuanti[tt].linkurl
window.open(cururl);
}


function ini()
{
if(!isns)
{
spacewidth=Math.round((divmask.offsetWidth-770)/2)
dmwidth=770+spacewidth
dmheight=divmask.offsetHeight
totalstep=50
timeout=50
dmstepw=Math.round(770/totalstep)
dmsteph=Math.round(dmheight/totalstep)
setTimeout('hidimg()',3000)
}
else swapPic()
}
function hidimg()
{
dmwidth-=dmstepw
dmheight-=dmsteph
eval('divmask.style.clip="rect(0,'+dmwidth+','+dmheight+',0)"')
hdrun=setTimeout('hidimg()',timeout)
if(dmwidth<=spacewidth&&dmheight<=0)
{
divmask.style.visibility='hidden'
clearTimeout(hdrun)
swapPic()
}
}
</script>
<BODY onmousemove="HideMenu()" leftMargin=0 topMargin=0 marginwidth="0" marginheight="0"" onLoad="swapPic()">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="5%" height="150">&nbsp;</td>
<td width="92%" valign="top">&nbsp;
<div align="center">
<a href=javascript:void(null) onClick='javascript:pictarget();return false;'><img src="../Image/nopic.jpg" width=150 height=130 border=0 name=pic style="visibility:hidden;filter: revealtrans(duration=2.0,transition=12)"><br>
</a></div></td>
<td width="3%"></td>
</tr>

</BODY>

搜索更多相关主题的帖子: 图片 javascript frequency function 幻灯片 
2007-07-02 11:18
快速回复:想加图片标题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011866 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved