网页滚动图片不循环,请求高手帮忙修改代码
网页滚动图片不能循环滚动,请大侠们帮忙,具体如下说明:本来是调用一个文件(CompVisualize.asp),现在想再增加Product.asp文件的调运,请高手忙帮忙...
网页滚动图片不能循环滚动,请大侠们帮忙,具体如下说明:
本来是调用一个文件(CompVisualize.asp),现在想再增加Product.asp文件的调运,请高手忙帮忙改写代码,万分感激!代码如下:
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 142/112){
if(image.width>142){
ImgD.width=142;
ImgD.height=(image.height*142)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
else{
if(image.height>112){
ImgD.height=112;
ImgD.width=(image.width*112)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
}
}
//-->
</script>
<%
Const New_img=10
set rs_case=server.createobject("adodb.recordset")
sqltext="select top 8 * from 0791idc_CompVisualize order by id desc"
rs_case.open sqltext,conn,1,1
if not rs_case.EOF then%>
<div align='center' id='demo' style='overflow:hidden;height:165px;width:630px;'><!--滚动区的高度和宽度-->
<table width="174" border='0' align='center' cellpadding='0' cellspacing="0" cellspace='0'>
<tr>
<td width="173" valign='top' id='demo1'>
<table width='88%' cellpadding='0' cellspacing='0' border='0' align='center'>
<tr valign='top'>
<%
while not rs_case.EOF
%>
<td align='center'>
<TABLE width=100% border=0 align=center cellPadding=3 cellSpacing=3>
<TR>
<TD width="206" height="85" align="center" ><table border="0" cellpadding="0" cellspacing="0" width="150">
<tr>
<!-- Shim row, height 1. -->
<td><img src="pic/spacer.gif" width="4" height="1" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="142" height="1" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="4" height="1" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr><!-- row 1 -->
<td colspan="3"><img name="gc_r1_c1" src="pic/gc_r1_c1.jpg" width="150" height="4" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="1" height="4" border="0" alt=""></td>
</tr>
<tr><!-- row 2 -->
<td><img name="gc_r2_c1" src="pic/gc_r2_c1.jpg" width="4" height="112" border="0" alt=""></td>
<td align="center"><a href="CompVisualizeBig.asp?ID=<%=rs_case("ID")%>"><img src="<%if rs_case("CompVisualize")="" then%>Img/nopic.gif<%else%><%=rs_case("CompVisualize")%><%end if%>" alt="<%=rs_case("Explain")%>" width="142" height="112" border="0" onload="javascript:DrawImage(this);"></a></td>
<td><img name="gc_r2_c3" src="pic/gc_r2_c3.jpg" width="4" height="112" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="1" height="112" border="0" alt=""></td>
</tr>
<tr><!-- row 3 -->
<td colspan="3"><img name="gc_r3_c1" src="pic/gc_r3_c1.jpg" width="150" height="4" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="1" height="4" border="0" alt=""></td>
</tr>
<!-- This table was automatically created with Macromedia Fireworks -->
<!-- http://www.macromedia.com -->
</table> </TD>
</TR>
<TR>
<TD height="24" align="center" valign="middle"><%=cutstr(rs_case("Explain"),8)%></TD>
</TR>
</TABLE>
</td>
<%
rs_case.MoveNext
wend
%>
</tr>
</table>
</td>
<td width="1" valign=top id=demo2></td>
</tr>
</table>
</div>
<%if New_img >5 then%>
<script>
var Picspeed=15
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar1=setInterval(Marquee1,Picspeed)
demo.onmouseover=function() {clearInterval(MyMar1)}还有代码但字节受限制 展开
本来是调用一个文件(CompVisualize.asp),现在想再增加Product.asp文件的调运,请高手忙帮忙改写代码,万分感激!代码如下:
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 142/112){
if(image.width>142){
ImgD.width=142;
ImgD.height=(image.height*142)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
else{
if(image.height>112){
ImgD.height=112;
ImgD.width=(image.width*112)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
}
}
//-->
</script>
<%
Const New_img=10
set rs_case=server.createobject("adodb.recordset")
sqltext="select top 8 * from 0791idc_CompVisualize order by id desc"
rs_case.open sqltext,conn,1,1
if not rs_case.EOF then%>
<div align='center' id='demo' style='overflow:hidden;height:165px;width:630px;'><!--滚动区的高度和宽度-->
<table width="174" border='0' align='center' cellpadding='0' cellspacing="0" cellspace='0'>
<tr>
<td width="173" valign='top' id='demo1'>
<table width='88%' cellpadding='0' cellspacing='0' border='0' align='center'>
<tr valign='top'>
<%
while not rs_case.EOF
%>
<td align='center'>
<TABLE width=100% border=0 align=center cellPadding=3 cellSpacing=3>
<TR>
<TD width="206" height="85" align="center" ><table border="0" cellpadding="0" cellspacing="0" width="150">
<tr>
<!-- Shim row, height 1. -->
<td><img src="pic/spacer.gif" width="4" height="1" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="142" height="1" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="4" height="1" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr><!-- row 1 -->
<td colspan="3"><img name="gc_r1_c1" src="pic/gc_r1_c1.jpg" width="150" height="4" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="1" height="4" border="0" alt=""></td>
</tr>
<tr><!-- row 2 -->
<td><img name="gc_r2_c1" src="pic/gc_r2_c1.jpg" width="4" height="112" border="0" alt=""></td>
<td align="center"><a href="CompVisualizeBig.asp?ID=<%=rs_case("ID")%>"><img src="<%if rs_case("CompVisualize")="" then%>Img/nopic.gif<%else%><%=rs_case("CompVisualize")%><%end if%>" alt="<%=rs_case("Explain")%>" width="142" height="112" border="0" onload="javascript:DrawImage(this);"></a></td>
<td><img name="gc_r2_c3" src="pic/gc_r2_c3.jpg" width="4" height="112" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="1" height="112" border="0" alt=""></td>
</tr>
<tr><!-- row 3 -->
<td colspan="3"><img name="gc_r3_c1" src="pic/gc_r3_c1.jpg" width="150" height="4" border="0" alt=""></td>
<td><img src="pic/spacer.gif" width="1" height="4" border="0" alt=""></td>
</tr>
<!-- This table was automatically created with Macromedia Fireworks -->
<!-- http://www.macromedia.com -->
</table> </TD>
</TR>
<TR>
<TD height="24" align="center" valign="middle"><%=cutstr(rs_case("Explain"),8)%></TD>
</TR>
</TABLE>
</td>
<%
rs_case.MoveNext
wend
%>
</tr>
</table>
</td>
<td width="1" valign=top id=demo2></td>
</tr>
</table>
</div>
<%if New_img >5 then%>
<script>
var Picspeed=15
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar1=setInterval(Marquee1,Picspeed)
demo.onmouseover=function() {clearInterval(MyMar1)}还有代码但字节受限制 展开
展开全部
<SCRIPT language=JavaScript>
function marquee1()
{
document.write("<div style='width:100%;overflow:hidden;' id=marquee onmouseover=clearInterval(repeat) onmouseout=repeat=setInterval(scrollMarquee,1)>")
}
function marquee2()
{
document.write("</div>")
marquee.childNodes[0].align='left';
if(marquee.childNodes[0].offsetWidth>marquee.offsetWidth) {
marquee.appendChild(marquee.childNodes[0].cloneNode(true));
}
else {
for(var i=0;i<Math.round(marquee.offsetWidth/marquee.childNodes[0].offsetWidth)+1;i++) {
marquee.appendChild(marquee.childNodes[0].cloneNode(true));
}
}
repeat=setInterval(scrollMarquee,1);
}
function scrollMarquee() {
if(marquee.scrollLeft<marquee.childNodes[0].offsetWidth)
marquee.scrollLeft++;
else
marquee.scrollLeft=0;
}
</SCRIPT>
<SCRIPT language=JavaScript>marquee1();</SCRIPT>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
</tr>
</table>
<SCRIPT language=JavaScript>marquee2(); </SCRIPT>
不是循环滚动,那是因为你的图片数量没有达到。
function marquee1()
{
document.write("<div style='width:100%;overflow:hidden;' id=marquee onmouseover=clearInterval(repeat) onmouseout=repeat=setInterval(scrollMarquee,1)>")
}
function marquee2()
{
document.write("</div>")
marquee.childNodes[0].align='left';
if(marquee.childNodes[0].offsetWidth>marquee.offsetWidth) {
marquee.appendChild(marquee.childNodes[0].cloneNode(true));
}
else {
for(var i=0;i<Math.round(marquee.offsetWidth/marquee.childNodes[0].offsetWidth)+1;i++) {
marquee.appendChild(marquee.childNodes[0].cloneNode(true));
}
}
repeat=setInterval(scrollMarquee,1);
}
function scrollMarquee() {
if(marquee.scrollLeft<marquee.childNodes[0].offsetWidth)
marquee.scrollLeft++;
else
marquee.scrollLeft=0;
}
</SCRIPT>
<SCRIPT language=JavaScript>marquee1();</SCRIPT>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
<td><img src="/images/nav_class_program.gif" width="80" height="60"></td>
</tr>
</table>
<SCRIPT language=JavaScript>marquee2(); </SCRIPT>
不是循环滚动,那是因为你的图片数量没有达到。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询