我的少女时代小说吗:代码调试!

来源:百度文库 编辑:高考问答 时间:2024/05/09 17:03:04
---哪位帮我把下面这断代码修改好!现在不好用.

</tr>
<tr>
<td height="150" bgcolor="#FFFFF4" width="540">
<table border="0" width="536" id="table19" height="151" cellspacing="0" cellpadding="0">
<tr>
<td>
<style type="text/css">
<!--
body {
background-color: #FCF5EB;
topmargin:0;
leftmargin:0;
}
-->
</style>
<DIV id=demo style="OVERFLOW: hidden; WIDTH: 539px; height:153px">

<TABLE border=0 align=center cellPadding=0 cellspacing="0" cellspace="0" width="524" height="150">
<TBODY>
<TR>
<TD id=demo1 width="515">
<table width="469" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCF5EB" height="144">
<tr align="center">

<td width="150">
<img src="image/cwbx.jpg" width="150" height="150" border="0" class=box></td>

<td width="160">
<img src="image/qcxl.jpg" width="150" height="150" border="0" class=box></td>

<td width="159">
<img src="image/tot.jpg" width="150" height="150" border="0" class=box align="left"></td>

</tr>
</table>
</TD>
<TD vAlign=bottom bgcolor="#FCF5EB" id=demo2 width="0"></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<DIV id=demo3 style="OVERFLOW: hidden; WIDTH: 0px; height:1px"></DIV>
<SCRIPT>
var speed=40
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth;
else{
demo.scrollLeft+=demo1.offsetWidth;
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {if(MyMar){clearTimeout(MyMar)}}
demo.onmouseout=function() {MyMar=setTimeout(Marquee,speed)}
</SCRIPT></td>
</tr>
现在网页中的图片不滚动,应该是哪里我写的不对吧,各位高手帮q我改一下吧,谢谢啦,,

因为demo已经滚动到了最右面.
代码一直在执行demo.scrollLeft+=demo1.offsetWidth; 而没有执行过demo.scrollLeft-=demo1.offsetWidth;

请把话说清,,代码发完,发以下代码供你参考

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onLoad="MM_preloadImages('imge/default10.jpg','imge/default_9.jpg','imge/default1_3.jpg','imge/default1_1.jpg')">
<div id=demo style=overflow:hidden;height:300;width:150;>
<table align=center cellpadding=0 cellspace=0 border=0>
<tr>
<td id=demo1 valign=top>
<a onMouseOver="MM_swapImage('Image25','','imge/default10.jpg',1)"
onMouseOut=MM_swapImgRestore()
href="product.asp"><img height=79
src="imge/default1_5.jpg"
width=88 border=0 name=Image25></a><img height=79 alt="" behavior
src="imge/default_10.jpg"
width=40><br><br>
<a onmouseover="MM_swapImage('Image26','','imge/default_9.jpg',1)"
onmouseout=MM_swapImgRestore()
href="product_2.asp"><IMG height=79
alt=""
src="imge/default_09.jpg"
width=88 border=0 name=Image26></a><IMG height=79 alt=""
src="imge/default11.jpg"
width=40><br>
<br>
<a onMouseOver="MM_swapImage('Image28','','imge/default1_3.jpg',1)"
onMouseOut=MM_swapImgRestore()
href="product_3.asp"><img
src="imge/default1_4.jpg" name=Image28
width=88 height=79 border=0 id="Image28"></a><img height=79 alt=""
src="imge/default12.jpg"
width=40><br>
<br>
<a onmouseover="MM_swapImage('Image27','','imge/default1_1.jpg',1)"
onmouseout=MM_swapImgRestore()
href="product_4.asp"><IMG
src="imge/default1_2.jpg" name=Image27
width=88 height=79 border=0 id="Image27"></a><IMG height=79 alt=""
src="imge/default13.jpg"
width=40><br><br>
<a onmouseover="MM_swapImage('Image271','','imge/default1_1.jpg',1)"
onmouseout=MM_swapImgRestore()
href="product_4.asp"><IMG
src="imge/default1_2.jpg" name=Image271
width=88 height=79 border=0 id="Image27"></a><IMG height=79 alt=""
src="imge/default13.jpg"
width=40><br><br>
<a onmouseover="MM_swapImage('Image272','','imge/default1_1.jpg',1)"
onmouseout=MM_swapImgRestore()
href="product_4.asp"><IMG
src="imge/default1_2.jpg" name=Image272
width=88 height=79 border=0 id="Image27"></a><IMG height=79 alt=""
src="imge/default13.jpg"
width=40><br><br></td></tr><tr>
<td id=demo2 valign=top></td>
</tr>
</table>
</div>
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
//if(demo2.offsetheight-demo.scrollLeft<=2)

if(demo.scrollTop>demo1.scrollHeight)
{
demo.scrollTop-=demo1.offsetheight
//alert(demo.scrollTop)
//alert(demo1.scrollHeight)
}
else{
demo.scrollTop++
//Text.value=demo.scrollTop

}

}
var MyMar=setInterval("Marquee()",speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
</body>
</html>