One page put 2 pieces of picture rolling code conflicting problems how to solve _javascript skills

Source: Internet
Author: User
Tags setinterval
Why do I copy two pieces of code at the same time on the homepage and the picture can't flow?
Copy Code code as follows:

<div align= "center" >
<table style= "table-layout:fixed; Border-collapse:collapse "cellspacing=0 cellpadding=0 width=760 border=1 height=" bordercolor= "#1989D7" >
<tr>
&LT;TD height= ">"
<div Id=demo style= "Overflow:hidden; width:100%; height:150px ">
<table cellpadding=0 align=left border=0 cellspace= "0" >
<tr>
&LT;TD id=demo1 valign=top><!--$ latest Pictures $--></td>
&LT;TD Id=demo2 valign=top></td>
</tr>
</table>
</div>
<SCRIPT>
var speed=25
Demo2.innerhtml=demo1.innerhtml
function Marquee1 () {
if (demo2.offsetwidth-demo.scrollleft<=0)
Demo.scrollleft-=demo1.offsetwidth
else{
demo.scrollleft++
}
}
var mymar=setinterval (Marquee1,speed)
Demo.onmouseover=function () {clearinterval (MyMar)}
Demo.onmouseout=function () {Mymar=setinterval (marquee1,speed)}
</SCRIPT>

Because these 2 pieces of code are identical, conflicts occur. Simply modify the code for another piece of code. The red callout place needs to be modified.
You try:
Copy Code code as follows:

<!--the second paragraph to the right scroll code start-->
<div id=gundong style= "Overflow:hidden; width:568px; Height:126px ">
<table cellpadding=0 align=left border=0 cellspace= "0" >
<tr>
&LT;TD id=gundong1 valign=top>
<!--{$GetPicPhoto (3,0,true,0,20,false,false,0,1,1,126,90,20,0,true,20)}--> </td>
&LT;TD id=gundong2 valign=top></td>
</tr>
</table>
</div>
<script>
var speed=25
Gundong2.innerhtml=gundong1.innerhtml
Gundong.scrollleft=gundong.scrollwidth
function Marquee1 () {
if (gundong.scrollleft<=0)
Gundong.scrollleft+=gundong2.offsetwidth
else{
gundong.scrollleft--
}
}
var mymar1=setinterval (Marquee1, speed)
Gundong.onmouseover=function () {clearinterval (MYMAR1)}
Gundong.onmouseout=function () {mymar1=setinterval (Marquee1, Speed)}
</script>
<!--the second paragraph to the right scroll code end-->

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.