图片在marquee中从下到上显示,每隔五秒停顿下,然后又继续往上显示,这样...
发布网友
发布时间:2024-10-23 23:36
我来回答
共1个回答
热心网友
时间:4分钟前
这个需要JavaScript代码和ASP动态的结合.
<style type="text/css">
<!--
.STYLE1 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div class="title_right" id="icefable1">
<div id="box1left">
<!--#include file="config3.asp"-->
<%
ptype=Trim(Request.QueryString("ptype"))
sql1 = "SELECT * FROM product order by id desc"
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.open sql1,conn,1,1
totalcs=rs1.recordcount
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF" frame="rhs" class="un" style="border-collapse: collapse">
<tr bgcolor="#FFFFFF">
<%
if not rs1.eof then
rs1.movefirst
rs1.pagesize=picperpage
if trim(request("page"))<>"" then
currentpage=clng(request("page"))
if currentpage>rs1.pagecount then
currentpage=rs1.pagecount
end if
else
currentpage=1
end if
if currentpage<>1 then
if (currentpage-1)*picperpage<totalcs then
rs1.move(currentpage-1)*picperpage
dim bookmark
bookmark=rs1.bookmark
end if
end if
if (totalcs mod picperpage)=0 then
totalpages=totalcs\picperpage
else
totalpages=totalcs\picperpage+1
end if
i=0
do while not rs1.eof and i<picperpage
%>
<td ><table width="173" height="195" border="0" align="center" cellpadding="0" cellspacing="0" background="images/mid_1.jpg">
<tr>
<td valign="top"><table width="130" height="190" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="174" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" colspan="2"> </td>
</tr>
<tr>
<td width="92%" height="148" align="center" valign="middle"><a href="<%=rs1("photo")%>" target="_blank" ><%="<img src="&rs1("photo")&" width=120 height=140 alt='点击浏览原图大小' border=0>"%></a></td>
<td width="8%" align="center" valign="middle"> </td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><a href="viewproduct.asp?ddd=<%=rs1("id")%>" target="_blank" ><%=rs1("gjgj")%></a></td>
</tr>
</table></td>
</tr>
</table></td>
<%
i=i+1
if i mod 3 = 0 then%>
</tr>
<tr bgcolor="#FFFFFF">
<%
end if
rs1.movenext
loop
else
if rs1.eof and rs1.bof then
%>
<td colspan="3" height="22" align="center"><p>当前没有产品!</p></td>
<%end if
end if
if not request("type")=1 then%>
</tr>
</table>
</div>
</div>
<script type="text/javascript">
marque(560,195,"icefable1","box1left")
var scrollElem;
var stopscroll;
var stoptime;
var preTop;
var leftElem;
var currentTop;
var marqueesHeight;
function marque(width,height,marqueName,marqueCName){
try{
marqueesHeight = height;
stopscroll = false;
scrollElem = document.getElementById(marqueName);
with(scrollElem){
style.width = width;
style.height = marqueesHeight;
style.overflow = 'hidden';
noWrap = true;
}
scrollElem.onmouseover = new Function('stopscroll = true');
scrollElem.onmouseout = new Function('stopscroll = false');
preTop = 0;
currentTop = 0;
stoptime = 0;
leftElem = document.getElementById(marqueCName);
scrollElem.appendChild(leftElem.cloneNode(true));
init_srolltext();
}catch(e) {}
}
function init_srolltext(){
scrollElem.scrollTop = 0;
setInterval('scrollUp()', 12);
}
function scrollUp(){
if(stopscroll) return;
currentTop += 1;
if(currentTop == marqueesHeight+1) {
stoptime += 1;
currentTop -= 1;
if(stoptime == (marqueesHeight)*1) {//停顿时间
currentTop = 0;
stoptime = 0;
}
}else{
preTop = scrollElem.scrollTop;
scrollElem.scrollTop += 1;
if(preTop == scrollElem.scrollTop){
scrollElem.scrollTop = marqueesHeight;
scrollElem.scrollTop += 1;
}
}
}
</script>
</td>
</tr>
</table>
<%end if%>
现在把源码发给你,不知道你可能看得明白